How to span radio button group across multiple containers Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

How to span radio button group across multiple containers

Post by fishnet37222 »

In the screenshot below you'll see that I have a set of radio buttons inside a single wxStaticBox. I have nested two wxPanels inside the box in order to have the controls on the left take up the same amount of space as the controls on the right. According to standard UX rules, when one of the radio buttons on the right is selected, the previously selected radio button in the group, whether it's on the right or the left, should be deselected. As you can see from the screenshot, this does not happen if the previously selected radio button is on the opposite side from the newly selected radio button.

Is there a way to get all the radio buttons in the same group even though they're in separate containers?
2017-09-03_12-27-10.png
2017-09-03_12-27-10.png (17.71 KiB) Viewed 804 times
Dave F.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: How to span radio button group across multiple containers

Post by New Pagodi »

It might be easier to use a grid sizer or flex grid sizer instead of 2 panels. In that case, the buttons would work automatically.

If you really want to use 2 separate panels, you'll have to handle the wxEVT_RADIOBUTTON event and when a button is selected in one panel, set all of the buttons in the other panel to be unselected.
Post Reply