How to get radio button which is toggled on?

is there any way to find which radio button is toggled on?

I’ve already declared my own int toggledButtonID which I update every time radio buttons are toggled.

But it seems to be obvious there should be already such method to find which button is toggled. That’s why I am asking.

The use of button acting as a radio (group-like) in juce is abstract in sense of there’s no true RadioButton component with a concrete status. You’re responsable to identify the different’s group by using ID’s and you need to observe (listening) the GUI change by overriding the buttonStateChanged or buttonClicked in Button::Listener class. Once you’ve get the instance of the button, you can simply get the radio id by calling getRadioGroupId(). Something like “dependency inversion principle” !

1 Like