How can I create multiple radio button groups on a single form?
Asked Answered
N

1

8

With VCL, we had a TRadioGroup class with an Items property you could modify at design time. With Firemonkey, we only have the TRadioButton class.

From what I understand, if you add objects of type TRadioButton as children to other container objects (e.g. TPanel, TGroupBox), these containers will effectively act like the VCL TRadioGroup objects.

However, these individual radio buttons seem to behave as if they are all children of the same parent. If you select a radio button in group A, and then select a radio button in group B, the radio button in group A is deselected.

How can I get radio buttons in one container object to not deselect radio buttons in other container objects?

Here's an example of my form design: enter image description here

Nora answered 21/6, 2012 at 15:17 Comment(3)
Perhaps next time you could just capture the image of the form you're designing, instead of the entire IDE? It would allow the image to be easier to see without the extraneous project manager/object inspector/etc.Southport
@KenWhite I was trying to emphasize the radio buttons were children of their container parents (which you can't tell by only looking at the form)Nora
It seems you could still crop it somewhat to make it easier to see. I upvoted your question. It was just a suggestion. :-)Southport
S
18

Set the GroupName properties of the buttons. Radio buttons with the same group name will act as a separate group.

Stcyr answered 21/6, 2012 at 16:34 Comment(3)
Well done. The documentation leaves a lot to be desired. This should be covered right at the top level of the TRadioButton docs.Scapegrace
Wow, perfect. Simple solution.Nora
@David: the entire documentation of FireMonkey still leaves a lot to be desired. My biggest gripe with the docs, at the moment.Umeko

© 2022 - 2024 — McMap. All rights reserved.