Variable Component Names

Hello

Could you please help me, I'm trying to find a way to call a variable checkbox.

i.e.

for (i = 10; i < 20; i++) {
Checkbox[i]->Caption = Some Database Information
};


Note: Checkboxes are all called Checkbox10 ~ Checkbox19
You can try the following, though I'm not sure whether the variable i shall be evaluated before the concat operation takes place.
1
2
3
4
5
#define concat( s1, s2 ) s1 ## s2

for (i = 10; i < 20; i++) {
 concat( Checkbox, i )->Caption = Some Database Information
};


Thanks for the answer, I'm nearly there however I'm getting the error

"Undefined symbol Checkboxi"

so it's not evaluating the variable prior to the operation :o(

Well the other (and more standard) option is to maintain a std::vector or array of those Checkboxes instead of naming them that way.
Topic archived. No new replies allowed.