JohnC
2008-08-06 11:31:18 UTC
Back to dynamic construction of radio buttons in objects.
Well, I thought I had this working until I needed more than one instance of
the object on my form.
Then it turned out that all the radio buttons (in all instances of the
object) belonged to the same group.
Here is what I have:
TGroupBox* RadioButtonBox;
TRadioButton** RadioButtons;
RadioButtonBox = new TGroupBox(Parent); //Parent is passed into the
constructor as the form
RadioButtonBox->Parent = Parent;
// more details about the box
for(int i=0;i<NmbChips;i++)
{
RadioButtons[i] = new TRadioButton(Parent);
RadioButtons[i]->Parent = Parent;
// more details about the button
}
Things work fine if I only have one instance of the object.
However, if I have more than one instance, all buttons from all of the
instances get thrown into the same group.
I need the buttons in each instance to be a group unto themselves.
I have tried setting the button's parent to the box, but then the buttons
are not visible, so I don't know if that would work.
If I change the parent in the button's constructor to the box it makes no
difference.
How can I force these to be in separate groups??
Thanks for any help you can give,
John
Well, I thought I had this working until I needed more than one instance of
the object on my form.
Then it turned out that all the radio buttons (in all instances of the
object) belonged to the same group.
Here is what I have:
TGroupBox* RadioButtonBox;
TRadioButton** RadioButtons;
RadioButtonBox = new TGroupBox(Parent); //Parent is passed into the
constructor as the form
RadioButtonBox->Parent = Parent;
// more details about the box
for(int i=0;i<NmbChips;i++)
{
RadioButtons[i] = new TRadioButton(Parent);
RadioButtons[i]->Parent = Parent;
// more details about the button
}
Things work fine if I only have one instance of the object.
However, if I have more than one instance, all buttons from all of the
instances get thrown into the same group.
I need the buttons in each instance to be a group unto themselves.
I have tried setting the button's parent to the box, but then the buttons
are not visible, so I don't know if that would work.
If I change the parent in the button's constructor to the box it makes no
difference.
How can I force these to be in separate groups??
Thanks for any help you can give,
John