04-24-2006 07:24 PM
04-25-2006 02:44 AM
Hello JR,
In each function to access a control, the first two parameters are 'panel' and 'control'. The 'panel' parameter should be the handle you obtain from the LoadPanel or NewPanel functions. So if you want to access a control on a second panel, just make sure that you use the correct panel handle for the 'panel' parameter.
If you're still confused, just let me know and I'll explain some further...
04-25-2006 03:00 AM
Hi Whim, thanks for the reply. I understand what you are saying but I need some further clarification. When a callback function is called from my second panel, I would like to alter content on BOTH the first and second panels. Changing control values for the second panel works fine but unfortunately whenever I try to access content on the first panel (during the same function call) I get an error stating that the panel handle is invalid (or something like that). Basically, it seems as if I am restricted to the controls on the panel in which the callback function was called. Here is the error message I get:
NON-FATAL RUN-TIME ERROR: "index.c", line 328, col 5, thread id 0x0000087C: Library function error (return value == -4 [0xfffffffc]). Panel, pop-up, or menu bar handle is invalid
thanks,
-JR
04-25-2006 03:08 AM
Hello JR,
accessing controls on another panel should not be a problem. Is it possible to post (or attach) some of your code?
04-25-2006 04:11 AM
04-25-2006 07:57 AM
Below, you will see some code for where I have identical looking toggle switches on two DIFFERENT panels for a poker timer/payout program. If one gets toggled, I want to make sure that both switches toggle to show the same value.
This shows exactly want you are trying to do. Hope it helps.
=====================
if ((mainpanelHandle = LoadPanel (0, "Timer.uir", mainPanel)) < 0)
return -1;
if ((paypanelHandle = LoadPanel (0, "Timer.uir", PayPANEL)) < 0)
return -1;
...
...
int CVICALLBACK Handle_Rebuy_Switch (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(mainpanelHandle,mainPanel_Rebuy_SWITCH, &Rebuy1);
GetCtrlVal(paypanelHandle,PayPANEL_Rebuy_SWITCH, &Rebuy2);
// if already activated then it was switched off
if (Rebuy_Taken)
{ // so set both to off
SetCtrlVal(mainpanelHandle,mainPanel_Rebuy_SWITCH, 0);
SetCtrlVal(paypanelHandle,PayPANEL_Rebuy_SWITCH, 0);
Rebuy_Taken = FALSE;
}
else
{ // set both to on
SetCtrlVal(mainpanelHandle,mainPanel_Rebuy_SWITCH, 1);
SetCtrlVal(paypanelHandle,PayPANEL_Rebuy_SWITCH, 1);
Rebuy_Taken = TRUE;
}
Calculate_Payouts();
break;
}
return 0;
}
04-25-2006 12:19 PM
04-25-2006 12:31 PM
04-25-2006 12:34 PM
Hi Dave. Nope, not using a strip chart. I must say that this is very confusing, as it seems to work just fine for everyone else 😛
BTW: i forgot to mention that the problem occurs when panel1 is called
-JR
04-25-2006 01:11 PM
I would use debugger and check the value of panel1 when it gets assigned via the loadpanel command.
Then check it where it is giving you problems. It could be that it is not loading properly (right name used, etc.?)
and, therefore, not assigning a valid integer number to it. When you first reference that invalid (in the CVI handle numbering scheme, not the invalid integer scheme) number, it bombs.
My thoughts for now.......