Iterating object variable names in C++

40 views Asked by At

I have a GUI written using GTK+ 2.0 and a dialog that has 8 tabs for different pages. On each page I have a five GTK::Entry fields for text input. This totals to 40 variables that I need to write a callback function for when the "Enter" key is pressed.

What I want to know is if it is possible to iterate and change the variable names according to which number tab I'm on. For example:

name_entry0

place_entry0

type_entry0

THEN

name_entry1

place_entry1

type_entry1

etc...

Basically creating a variable with its associated tab number on the end of the variable, using a for loop so I don't have to do it 8 times for each variable.

0

There are 0 answers