Radio buttons in few group boxes

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
vzeljko
Posts: 35
Joined: Wed Sep 28, 2016 8:02 pm

Radio buttons in few group boxes

Post 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
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Radio buttons in few group boxes

Post 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.]

Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Radio buttons in few group boxes

Post 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.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
vzeljko
Posts: 35
Joined: Wed Sep 28, 2016 8:02 pm

Radio buttons in few group boxes

Post 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
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Radio buttons in few group boxes

Post 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...
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
vzeljko
Posts: 35
Joined: Wed Sep 28, 2016 8:02 pm

Radio buttons in few group boxes

Post 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
Post Reply