The only think I can see is you do not set a buttonWidth, but you call it in resized(). Components nog having proper heights and widths is a common mistake that leads to unpredictable behavoir - I’ve wasted many hours because of such errors… Try a setSize in the constructor.
Hi tomto66, thanks for the reply! setSize() has made no difference. In the example Juce provide the two issues you’ve mentioned are corrected but the overall problem is still there. The issue goes away if I comment out .setRadioGroupId(), however this defeats the point…
Would love someone to try the linked example and see if they suffer the same issue?
I copied your code into an empty Application and it worked as expected.
However I noticed, that the colour of the on state is very subtly different from the off state.
You can make it more obvious by adding these two lines to your constructor (the values will be inherited to the child components):
Each button can be selected and then shows the ‘(selected)’ in text next to it… Only both can go into that state at the same time and then never changed back to unselected
I’m not sure what else could be the issue then, it seems to be working fine. Can you check the widgets demo in the DemoRunner app? There is a set of radio buttons on the “Buttons” tab here which should be behaving the same:
Okay great, I’ve ran the widgets demo and it works as expected for me. I’m away until Saturday but I will copy over the relevant lines from that demo into my project and check whether the issue persists. Thanks