I wonder, if I shall work with 6 radiogroups and let them interact in the way
But how to grab the results? I would have to digg into the mess of 5 groups.
You make the form-level private property and encapsulate all that mess inside one getter and one setter functions.
You also make a single OnClick event for all the radiogroups.
But notice, that the name is wrong, the event is actually on-change one, so when RG 1 would be removing selection from RG 2 - that group 2 would fire it immediately, reentrantly. See recent forum threads on TCheckBox for the evermore batle of "be Delphi-compatible" vs "be consistent"However, you have to think in advance about "composite item index" - how would you identify those items? What this propery would reort/accept as a value?
Would you just make incremental values, then, for example, you had 3 radiobuttons in group 1, then you want to add a 4th radiobutton there, but you can not. This RB then would be #3 but all your code and databases already fixed it that #3 is the first radiobutton of the seconf group...
OTOH, that holds for every visual design, radiogroups or not.
And from visual design point i dislike the radiogroups, as they might confuse user... Hopefully not for long, but still.
Maybe you can go with TListBox or with TComboBox/TComboBoxEx instead. Albeit i personally think the "selected" state in fancy modern combobox is much less visually distinct than "dull old" radiobutton.
The problem is, that my groups are not of the same size.
Are they really so large, than multi-column layout is required? Today many screens are large. Okay, the cheapest laptops seem to stick as 1300x760, yet even that is actually a lot. Funny to remember, many years ago i believed 1024x768 was the ideal resolution and increasing it further would be worsening human experience.
You never hinted at that before, BTW.
Some problem with multi-column is that you can no more have easy auto-size. You would have to fix the size of all the controls in designtime, and then hope the scaling for different font sizes and display resolutions would happen automagically. Hopefully it would.
But okay then, try your luck with TFlowPanel. But then all the "hader labels" and all the radiobuttons would have to have no Align and no AutoSize but carefully selected sizes.
Also you would probably want to use TFlowPanel.OnResize to proactively make header labels almost as wide (save few pixels for margins and borders) as TFlowPanel.CustomWidth
Or maybe headerlabels ".Anchors" could do it automagically, but i was hit few times with inconsistent Anchors in Delphi under less than trivial conditions, like those with lockdowns and remote work, so today i abhor Anchors.Additionally, what if a user resizes the window (and the panel) and your 4-columns design suddenly snaps into 3-columns design? You would, perhaps, have to use TFlowPanel.OnResize to smartly resize radiobuttons, so they retain the order once designed.
You can also try with TGridPanel but i am not sure it would be a good choice here, both "headerlables" that have to span several columns (all of them, actually) and then all columns having the same width, meaning a really long RB in group2 col2 would make equally wide slot for otherwise narrow RB in group1 col1