LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

invalid control id

Return value = = -13, Invalid control ID.

 

Created a program with one PANEL.

 

panelHandle was assigned to that PANEL.       panelHandle=LoadPanel(0,"Cal2400.uir",PANEL).

 

Had one child panel.                                         password   =  LoadPanel(panelHandle,"Cal2400.uir",PASSWORD);   

 

Every thing worked fine.

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

Then I created some TABPANEL, TABPANEL_2 and TABPANEL_3 panels.

 

Now all I get is Invalid control ID.  The only controls are on the TABPANEL.  The other panels only hold visuals for the operator.

 

All statements were changed to reflect the TABPANEL - SetCtrlAttribute(panelHandle,TABPANEL_WAIT, ATTR_VISIBLE, 1);

 

The panelHandle starts out assigned the value 1 and then changes to 3 in the same CVICALLBACK function.  All that works fine.

 

I then step out of that function and go to another function and the panelHandle variable changes back to 1.

 

SetCtrlVal(panelHandle,TABPANEL_HP3458A,data);  

 

This generates the Invalid control ID because it is looking for the value 3.

 

Previous to this I created a program that uses 30 TABPANEL’s and 10 of them had all there own separate controls.  There never was an issue and the program works great with no Invalid control ID.

 

Tried eliminating the password panel but that did not help.  I can force panelHandle to the right variable, but that is not acceptable.

0 Kudos
Message 1 of 3
(3,619 Views)

Each panel that you load needs its own handle. So if you have, for example:

    int panelHandle;
    ...
    panelHandle=LoadPanel(0,"Cal2400.uir",PANEL);

then when you load a different panel you need a different handle to access the controls it contains:

    int tabPanel1Handle;
    ...
    tabPanel1Handle=LoadPanel(0,"Cal2400.uir",TABPANEL);
    ...
    SetCtrlVal(tabPanel1Handle,TABPANEL_HP3458A,data);

It is not clear from your problem description that you are using the handles corectly - maybe if you posted a bit more code it might help us to diagnose the problem further.

JR

0 Kudos
Message 2 of 3
(3,606 Views)

Thanks for responding.

It turns out that all that was required is the following, which I had done in my previous program, but didn't make sense for this one.

#define PAGE_ONE    0


 GetPanelHandleFromTabPage (panelHandle, PANEL_TAB1, PAGE_ONE, &tabpanel);  

 

PAGE_ONE being the first TAB where all the controls are.  'tabpanel' is then the new identifier for that panel.

 

When one puts controls on the other panels then  #define PAGE_TWO  2  and use the GetPanelHandleFromTabPage() statement.

0 Kudos
Message 3 of 3
(3,593 Views)