SetterBar/ButtonBar, Dynamic and the visual appearance of "selected"
- To: mathgroup at smc.vnet.net
- Subject: [mg104329] SetterBar/ButtonBar, Dynamic and the visual appearance of "selected"
- From: Jason Ledbetter <jasonbrent at gmail.com>
- Date: Wed, 28 Oct 2009 04:05:41 -0500 (EST)
Folk, Once again I'm trying to understand some UI nuances in Mathematica... I'm trying to use SetterBar or ButtonBar as selectors for portions of a dataset with an action attached. This basically works however when I have an action associated with either, the selected button doesn't visually appear selected when clicked... A sample of what I'm doing is below; my basic goal is to use either of the last 2 of these four examples but have the button highlighting act like the first two examples. Clear[x1, x2, y1, checkSwitch]; (* appears to force no default selection w/ SetterBar *) (x1 = Null; x2 = Null; y1 = Null;) choices = {"one", "two", "three"}; checkSwitch[button_] := Switch[button, _, Print[button]] Panel[{Column[{ Style["SetterBars", Bold], Style["No Dynamic, button stays highlighted", Italic], SetterBar[x1, # -> # & /@ choices], Style["Dynamic WITHOUT action, button stays highlighted", Italic], Row[{SetterBar[Dynamic[y1], # -> # & /@ choices], Dynamic[y1]}], Style["Dynamic with action, button does not stay highlighted", Italic], SetterBar[Dynamic[x2, checkSwitch[#] &], # -> # & /@ choices], Style["ButtonBars", Bold], Style["Dynamic with action, button does not stay highlighed", Italic], ButtonBar[# :> checkSwitch[#] & /@ choices] }] }] TIA, -jbl