Use the Tabs Genie
- Last UpdatedJul 18, 2023
- 2 minute read
There are two ways to populate data to the tabs:
-
Set cell value directly to the table.
-
Binding a Cicode function to return the value for the individual tabs.
Example 1
Set create tabs statically on initialization
The Cicode sample below will be used in the following example. Open the Cicode Editor and create a new Cicode file, for example: _MyTab_Ex1.ci
//Callback function to respond to the initialization event of the tab genie
INT FUNCTION MyTabs_Init(STRING sTabs)
// Pre-populate with 2 auto-width tabs
LibTabs_AddTab(sTabs, "Tab1", 0);
LibTabs_AddTab(sTabs, "Tab2", 0);
RETURN TRUE;
END
-
From Graphics Builder create a new page (for example, a Normal Tab Style Page).
-
When created, from the Object Toolbox select the Paste Genie icon.
-
In the Paste Genie window, select the lib_contols library.
-
Select the Tabs genie. The genie is pasted onto the graphics page.
-
In the Tab Genie dialog, configure the fields according to the table below. Click OK to save the changes.
-
Save the graphics page, and compile and run the project.
|
Parameter |
Description |
|---|---|
|
Tab BarName |
MyTabs1 |
|
Width |
400 |
|
Height |
30 |
|
Initialize |
MyTabs_Init("#Name") |
At runtime the tab layout should look like the following:

Example 2
Binding a Cicode function to return the value for the individual tabs
This is similar to setting a formula in Excel. With binding, cell values are not stored in the tabs control. the control will call the provided Cicode function when it needs the data.
Using the Cicode sample below, open the Cicode Editor and create a new Cicode file. For example: 'MyTabs_Ex2.ci'
INT FUNCTION MyTabs_InitDyn(STRING sTabs)
// Bind callback function for data display
LibTabs_SetDataTask(sTabs, "Value", "MyTabs_GetCellValue", "^"#Name^",#Tab");
// Set the number of tabs for the control
LibTabs_SetCount(sTabs, 3);
RETURN TRUE;
END
//Function to return the value for a data cell
STRING FUNCTION MyTabs_GetCellValue(STRING sTabs, INT nTab)
RETURN "Dyn. value for Tab(" + nTab:# + ")";
END
-
As in example 1, add a tabs library control to the graphics page.
-
In the Tabs Genie dialog, configure the fields according to the table below.
-
Save the graphics page, and compile and run the project.
|
Parameter |
Description |
|---|---|
|
Tabs Name |
MyTabs2 |
|
Width |
400 |
|
Height |
30 |
|
Can Remove Tab |
TRUE |
|
Initialize |
MyTabs_Initdyn("#Name") |
At runtime the tab layout should look like the following:
