SetCtrlVal() is looking for an integer which it will look up in the constants defined in the UIR .h file. Casting a string as an int doesn't look at the string as a symbol or constant name; it casts the ASCII string as an integer.
One way to set values of controls in a loop is to build an array of the constant names. It's an int array containing the values of the control constants (by constant name), not a string array containing the names. Make sure you use the control constant names, not their value from the UIR .h file: CVI can change those values anytime you edit the UIR file. For example, if your panel constant is PANEL and you have 5 checkboxes CHECKBOX_1 through CHECKBOX_5, your array difinition could be
int nCheckBoxes[] =
{PANEL_CHECKBOX_1,
PANE
L_CHECKBOX_2,
PANEL_CHECKBOX_3,
PANEL_CHECKBOX_4,
PANEL_CHECKBOX_5};
#define NUMCHECKBOXES sizeof(nCheckBoxes) / sizeof(int)
...
int main(int argc, char *argv[])
{
...
}
int SetAllHigh()
{
int i;
for (i=0; i nCheckBoxes[i] = 1;
}
See the attached example for more details.