LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab inside a tab

Hi I have a problem using Tab controls : I create a tab in a panel. I create another tab IN this first tab. Finally, I create another tab IN this second tab. (look at the uir file attached) I don't know how to access controls in each of these tabs. thanks for your help.
0 Kudos
Message 1 of 5
(3,579 Views)

Hi,

to access a control on a tab page, you should always obtain a handle to the tab page (similar to panel handle). Use the GetPanelHandleFromTabPage function to obtain the handle. Now, use this tab page handle in the same way you would use a panel handle to access the controls on a panel.

Example: In your UIR, you create a panel, PNL. On this panel, you create a tab control, MAINTAB. The 4th tab page of this main tab is called TABMAIN4. On this 4th tab page, you create another tab control, called SUBTAB. The 3rd tab page of this tab page is called TABSUB3. On this 3rd tab page, you create a numeric control, called NUMERIC. Below is the code used to access this numeric control:

int pnlHandle;
int maintabHandle;
int subtabHandle;

// Get panel handle.
pnlHandle = LoadPanel (0, "UserInterface.uir", PNL);
// Get handle for 4th tab page on the main tab control.
GetPanelHandleFromTabPage (pnlHandle, PNL_MAINTAB, 3, &maintabHandle);
// Get handle to the 3rd tab page on the sub tab control, which is located
// on the 4th tab page of the main tab control.
GetPanelHandleFromTabPage (maintabHandle, TABMAIN4_SUBTAB, 2, &subtabHandle);
// Adjust the numeric value of a numeric control which is located on the
// 3rd tab page of the sub tab control.
SetCtrlVal (subtabHandle, TABSUB3_NUMERIC, 10);

 

Hope this helps. If not, please post again...

Message 2 of 5
(3,575 Views)

The correct approach when working with tabs is to consider each page of a tab control as a panel (which in effect it is). The panel handle associated with a specific tab page can be obtained with GetPanelHandleFromTabPage, so in your example the panel handle of your tab page "Gestion Acquisition Analogique" can be obtained with

GetPanelHandleFromTabPage (panelHandle, PANELCAN_TAB, 0, &firstTabHandle);

The panel handle of "Voie 1" tab page results from

GetPanelHandleFromTabPage (firstTabHandle, TAB_ACQ_TAB_2, 0, &secondTabHandle);

and finally the habdle of your "Acquisition" tab page is

GetPanelHandleFromTabPage (secondTabHandle, TABPANEL_3_TAB, 0, &thirdTabHandle);

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 5
(3,573 Views)
OK thanks both for your answers, I understand now See You
0 Kudos
Message 4 of 5
(3,559 Views)
That worked like a charm Wim. Thank you.
0 Kudos
Message 5 of 5
(2,574 Views)