GUI radio button vs checkbox button

Dears,
Not sure if this is just a question or a feature request, but here goes:
I found myself unable to uncheck the radio button to make it work like a checkbox.
Apparently, according to the doc, the radio button is intially ment to work for a group, although you can assign each to a different group so they work independantly. But when I use button.isChecked (bolean), it seems to work only to change the state once (to enabled) and I’m unable to set a disabled state again (a toggle). Is it just me being stupid? Else, since it’s mostly already there with its round shape (as opposed to the square checkbox), wouldn’t it be nice to be able to use the radio button in checkbox mode?
Thanks,

I guess it might be by design, let bring @PatrickRyan to the thread

@mawa, I would say that @sebavan is correct in that the radio button, by design, is supposed to handle toggling on with click only since the ideal usage is to group radio buttons and have only one enabled at a time. This means that the default behavior should be enable on click only and do not disable on click. If you were to want control over how the checkboxes looked, I would suggest that the feature would be adding image capabilities to the checkbox rather than modifying the behavior of the radio button control.

That said, if you want to use the radio button as a circular checkbox, you certainly can hijack it to work that way. Here is a simple example where you can toggle the radio button simply by clicking on it multiple times or by clicking on the button below it. In this case, we rely on the standard behavior of the radio for enabling and simply have to handle manually disabling it when you click on an enabled radio button.

Where this will break down is if you group several radio buttons together, but since you want this more as a checkbox and not a radio button, you shouldn’t be grouping them anyway. Hope this helps with what you are doing.

3 Likes

Hope you are well. Thanks a lot for the always detailed reply. :smiley:

I think that would be nice. At least for some basics. I mean, I certainly know how to build one but having a choice of simple design could be a ‘nice to have’ (without all too much effort I believe).

Nah, I don’t think I would do that. Easier to create my own design with a checkbox behavior but thanks for the insight.

Actually, I wasn’t really doing anything. I was just rushing an interface for a testing PG. I guess that’s eventually where you spot potential improvement for faster and easier building :smiley: I don’t think while doing my project I would have even thought of it. I probably would have gone custom from the start.
Have an amazing weekend :sunglasses:


Edit: Thinking of it with a delay (sry I’m swiss, I’m slow… I need time to digest :wink:
I believe it would be a real ‘nice to have’ to slightly rethink the way the checkbox control is built and make it similar to a button (understand with parts). I.E. by adding a tb, one could turn it into a ‘real’ checkbox with a ‘v-checked’ and eventually a cross when unchecked. The shape could be square or with a corner radius or a circle. The inner (active) and outer part could both have their own stroke (weight and color) and bg color or even bg image. What do you think?