Why does value not transfer from dynamically created ring control into the CVICALLBACK function?
I created ring control so:
int i,control;
char *Program_mode[2]={"Control Mode","Monitoring Mode"};
Toolbar_New (panel, menuBar, "", 0, 0, 1, 1, &Window_toolbar);
Toolbar_InsertItem (Window_toolbar, END_OF_LIST, kRing, 1, "Program Mode",
kControlCallback, 0, ProgramModeCallback, NULL, "");
// get panel, control values
Toolbar_GetCtrlFromDescription(Window_toolbar, "Program Mode", &panel, &control);
// insert program modes options: "Control Mode","Monitoring Mode"
for (i=0; i<=1; i++)
{
InsertListItem (panel, control, -1, Program_mode[i], i);
}
CVICALLBACK function is:
int CVICALLBACK ProgramModeCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int Monitoring_mode;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control,&Monitoring_mode);
if (Monitoring_mode)
{
SetCtrlAttribute (panel,control,ATTR_TEXT_BGCOLOR, 0x00B7FFB7); // light green
}
else
{
SetCtrlAttribute (panel,control,ATTR_TEXT_BGCOLOR, 0x00FF80FF); // light red
}
break;
}
return 0;
}
The "panel" value doesn't transfer into the function.
But if I create this control manually It transfers excellent.
At the left of the attached picture there is the dynamically created ring control and at the right - manually created ring control.