View Full Version : ToggleButton behaviour

27 Aug 2008, 6:13 AM
I noticed something about ToggleButton and I was wondering if this is indeed the intended behaviour or just a problem to be fixed: when several ToggleButton elements are added to an ButtonBar and one is pressed, the others do not become untoggled, meaning that in the end, you end up with several pressed buttons if you don't release them by hand. Is this supposed to behave like that? Wouldn't it be more natural that when one is pressed, the others are automatically released?

27 Aug 2008, 1:32 PM
I think that would depend on the use case - for example the bold/italic/underline buttons in MSWord shouldn't operate like that at all.

If you need that functionality, it would not take a lot of coding to make it work (ie listen for a keypress and unselect all the others) - I would probably look at creating a ToggleButtonGroup class that you can register ToggleButtons with.