Hello Dima2882,
So from your post, are you saying that your basic setup is something like:
static int panelHandle;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "printtext.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
}
int CVICALLBACK SwitchCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int value;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (panelHandle, PANEL_BINARYSWITCH, &value);
break;
}
return 0;
}
I would make sure when you call LoadPanel, that you assign the returned value to panelHandle. The value stored in the panel parameter of your callback is the same handle that was returned by the LoadPanel, NewPanel or DuplicatePanel functions. So you shouldn't have to redeclare panelHandle or assign it the value of panel. It might be helpful for you to post a small portion of your code so we can see what is going on.
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter