Board index » cppbuilder » Accessing Component Propeties via Components[] array

Accessing Component Propeties via Components[] array


2003-08-08 05:05:19 AM
cppbuilder62
I'm writing a program in cbulider 6 which processes the values of several
form components, specifically the ItemIndex property of a large number of
RadioGroups. Rather than accessing the properties of each RadioGroup
manually, like
value[1]=RadioGroup1->ItemIndex;
value[2]=RadioGroup2->ItemIndex;
...and so on, is there a way that I can access the components' ItemIndex
property by going through the Components[] array instead?
Thanks in advance for your help.
 
 

Re:Accessing Component Propeties via Components[] array

"sctrojan79" < XXXX@XXXXX.COM >wrote in message
Quote
...and so on, is there a way that I can access the
components' ItemIndex property by going through
the Components[] array instead?
Yes. For example:
int index = 0;
for(int x = 0; x < ComponentCount; x++)
{
TRadioButton *btn = dynamic_cast<TRadioButton*>(Components[x]);
if( btn )
value[index++] = btn->ItemIndex;
}
Gambit