xsharp.eu • Radio buttons in few group boxes
Page 1 of 1

Radio buttons in few group boxes

Posted: Thu Feb 03, 2022 3:21 pm
by vzeljko
I put three group boxes on winform window. Each of those group boxes has two radio buttons. I can't choose a radio button in each group box, only one of all radio buttons. Is there a solution except using checkboxes but this is complicated.

Zeljko

Radio buttons in few group boxes

Posted: Thu Feb 03, 2022 4:24 pm
by FFF
I just made the attached aef, where i can set in each group one button. Maybe you find in the code the difference to your app?

[The extension viaef has been deactivated and can no longer be displayed.]


Radio buttons in few group boxes

Posted: Thu Feb 03, 2022 4:31 pm
by Chris
Hi Zeljko,

Are you sure this is a WinForms window and not a VO window like a DataWindow? Because in WinForms, this is handled automatically, as long as every radio button is trully "inside" the groupbox, so if you move around the groupbox in the designer, then the radios (and any other controls inside them) are moved together. If they are not, it means the parent for both the groups and the radios is the form, and you need to drag & drop again the radios to put them "inside" the groups.

Radio buttons in few group boxes

Posted: Thu Feb 03, 2022 10:09 pm
by vzeljko
Karl,
I imported your sample app and added few lines of code to check default radio buttons in each group box and it works as I expected. The same I did in my app, but only one could be checked.
Then I removed radio buttons from groupboxes and later put them in groupboxes again as Chris suggested.
Now everything works fine.
Thanks,
Zeljko

Radio buttons in few group boxes

Posted: Fri Feb 04, 2022 8:07 am
by FFF
Zeljko,
did you compare the code? Could it be you initially added radio buttons to the form, and later on grouped them? I'd think if so, the painter didn't/couldn't know that it had to add the code which makes the rb belong to each's group...

Radio buttons in few group boxes

Posted: Fri Feb 04, 2022 11:53 am
by vzeljko
Karl,
it seems that I didn't put radio buttons initially inside group box but probably outside and then moved inside. Maybe, cut/paste. When I deleted them and put new ones from toolbox directly to group box everything works fine.
Zeljko