I'm trying to create a set of SetterBar
within my DynamicModule
, but I want to have it so that an individual button gets disabled if a certain button is pressed on a different setter bar. Here is the relevant code:
DynamicModule[{Clo = 1, Cp = 0, Cprj = 0},
GraphicsColumn[{
Column[
{Style[
"Location of C",
FontSize -> 10],
SetterBar[
Dynamic[Clo], {0 -> "Origin",
1 -> "Tip of B"}]},
Alignment -> Center, Background -> None],
Column[{
Style["Location of (A.C)A^", FontSize -> 10],
SetterBar[Dynamic[{Cp, Cprj}], {
{0, 0} ->
Style["Origin of C", FontSize -> 9],
{1, 0} ->
Style["Tip of C", FontSize -> 9], {0, 1} ->
Style["End of (A.B)A^",
GrayLevel[Dynamic[(Clo*-0.7) + 0.7]], FontSize -> 9]
}]},
Alignment -> Center, Background -> None],
Row[{"Clo = ", Dynamic[Clo], " Cp = ", Dynamic[Cp],
" Cprj = ", Dynamic[Cprj]}]}]]
This yields the result of the image below.
Here I clicked on "Origin" and "End of ...", the latter being the original formatting of the labels. Is there a way to actually disable the "End of ..." button while still having it display, if and only if Clo=0
? I want to have it so that it is not possible to click on the grayed out option, but possible to toggle between the other two.
SetterBar
withRow[MapThread[ Setter[Dynamic[{Cp, Cprj}], {#}, #2, Enabled -> #3] &, {{{0, 0}, {1, 0}, {0, 1}}, {Style["Origin of C", FontSize -> 9],Style[ "Tip of C", FontSize -> 9], Style["End of (A.B)A^",FontSize -> 9, FontColor -> GrayLevel[Dynamic[(Clo*-0.7) + 0.7]]]}, {True, True, Dynamic[Clo == 1]}}]]
? $\endgroup$