InsertTabPage
int InsertTabPage (int panelHandle, int controlID, int index, char tabLabel[]);
Purpose
Inserts a tab page into the tab control.
Inserting the new tab page causes the indices of existing tab pages at and beyond the insertion point to increase by one.
The function returns the index of the new tab page or an error.
Example Code
The following code demonstrates how to create a tab control, insert tab pages, and add a command button to each tab page.
int tabCtrl, tab1, tab2, tabPanel1, tabPanel2, testButton, quitButton,
panelHeight = 0, panelWidth = 0;
/* Create a new tab control */
tabCtrl = NewCtrl (parentPanel, CTRL_TABS, "Test Control", 100, 100);
/* Insert two tab pages */
tab1 = InsertTabPage (parentPanel, tabCtrl, 0, "Test Tab One");
tab2 = InsertTabPage (parentPanel, tabCtrl, 1, "Test Tab Two");
/* Get the panel handle for the first tab page */
GetPanelHandleFromTabPage (parentPanel, tabCtrl, 0, &tabPanel1);
/* Get the height & width of the first tab page using the panel handle you obtained in the previous function */
GetPanelAttribute (tabPanel1, ATTR_HEIGHT, &panelHeight);
GetPanelAttribute (tabPanel1, ATTR_WIDTH, &panelWidth);
/* Add a command button to the first tab page using its panel handle */
testButton = NewCtrl (tabPanel1, CTRL_SQUARE_COMMAND_BUTTON_LS, "Test Button", panelHeight - 50, panelWidth - 100);
/* Get the panel handle for the second tab page */
GetPanelHandleFromTabPage (parentPanel, tabCtrl, 1, &tabPanel2);
/* Add a command button to the second tab page using its panel handle */
quitButton = NewCtrl (tabPanel2, CTRL_SQUARE_COMMAND_BUTTON_LS, "Quit", panelHeight - 50, panelWidth - 75);
/* Make the second tab page the active tab page */
SetActiveTabPage (parentPanel, tabCtrl, 1);
Supported Controls
You can use InsertTabPage with tab controls.
Parameters
Input | ||
Name | Type | Description |
panelHandle | int | Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel. |
controlID | int | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by functions such as NewCtrl and DuplicateCtrl. |
index | int | Zero-based index into the list where InsertTabPage places the new tab page. Pass –1 to insert the new tab page at the end of the list. |
tabLabel | char [] | Label of the new tab page. |
Return Value
Name | Type | Description |
newTabIndex | int | Returns the index of the new tab page. Use this index to specify the tab page index in subsequent function calls. Negative values indicate that an error occurred. |
Additional Information
Library: User Interface Library
Include file: userint.h
LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later