LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

getpanelhandlefromtabpage always returning zero, can't access user controls on tabs

Hello,
Currently I have a relatively simple gui in a .uir file, it is just a panel with a tab control on it. It has two pages, and each one has various fields and control buttons. I am trying to read a value from a numeric on a tab. It always gives me the error
 
NON-FATAL RUN-TIME ERROR:   "AutoUF.c", line 63, col 5, thread id 0x000006E0:   Library function error (return value == -4 [0xfffffffc]). Panel, pop-up, or menu bar handle is invalid
 
Here's what I have:
 
#define PAGE_ONE 0;
#define PAGE_TWO 1;
 
static int panelHandle;
static int acqTabPanelHandle;
static int chanTabPanelHandle;
 
double temp;
 
panelHandle = LoadPanel (0, "AutoUF.uir", PANEL)   //returns 1 always
 
//both of the next two function calls return 0 always
acqTabPanelHandle = GetPanelHandleFromTabPage (panelHandle,PANEL_Main,PAGE_ONE,&acqTabPanelHandle);
chanTabPanelHandle = GetPanelHandleFromTabPage (panelHandle,PANEL_Main,PAGE_TWO,&chanTabPanelHandle); 
 
//So then, if I do something like this I get the error
GetCtrlVal(acqTabPanelHandle, AcqTab_field_sampPeriod, &temp);
 
I've used CVI 8.0 before and this is how I did it, I am currently using CVI 8.1. For reference, my main panel in the .uir is called PANEL. The Tab is called PANEL_Main. The first tab is called AcqTab, the second is ChanTab.
Thanks in advance!
Alex 



Message Edited by Baselerd on 05-27-2008 12:25 PM
0 Kudos
Message 1 of 3
(3,193 Views)
acqTabPanelHandle = GetPanelHandleFromTabPage (panelHandle,PANEL_Main,PAGE_ONE,&acqTabPanelHandle);
chanTabPanelHandle = GetPanelHandleFromTabPage (panelHandle,PANEL_Main,PAGE_TWO,&chanTabPanelHandle);

Don't assign the return value to your panel variables. This function uses the standard convention of returning a status code (see the function documentation). This behavior has not changed. I expect that everything will work as expected if you avoid overwritting your tab panel variables.

Mert A.
National Instruments
0 Kudos
Message 2 of 3
(3,185 Views)
Thanks alot! It was such a careless error, but either way you saved me a lot of pain 😃 I had been working on this all morning 😕
Cheers,
Alex
0 Kudos
Message 3 of 3
(3,179 Views)