TabControl class

A TabControl is a special kind of container window that organizes several controls in multiple pages. When clicked, the page displays only the controls assigned to it and hides the rest.

Creating tab controls and pages

You have several options to create a tab control with pages:

// To create a tab control with pages, the caption variable must contain the page names separated by newlines.

$tab = wb_create_control($mainwin, TabControl, "Page0\nPage1\nPage2'", $x, $y, $w, $h, ID_TABCONTROL, WBC_VISIBLE);

// Create an empty tab control and add pages to it by passing an array to wb_create_items().

$tab = wb_create_control($mainwin, TabControl, "", $x, $y, $w, $h, ID_TABCONTROL, WBC_VISIBLE);
wb_create_items($tab, array("Page0", "Page1", "Page2"));

// Create an empty tab control and add the pages later with several calls to wb_create_items().

$tab = wb_create_control($mainwin, TabControl, "", $x, $y, $w, $h, ID_TABCONTROL, WBC_VISIBLE);
wb_create_items($tab, "Page0");
wb_create_items($tab, "Page1");
wb_create_items($tab, "Page2");

To create the child controls for each page, you must use the tab control as the parent window and set the ntab parameter in function wb_create_control() to the desired page number:

// Add controls to the first page

wb_create_control($tab, Label, "This will go to Page 0", $x1, $y1, $w1, $h1, 0, WBC_VISIBLE, 0, 0);
wb_create_control($tab, Edit, "This will go to Page 0", $x2, $y2, $w2, $h2, 0, WBC_VISIBLE, 0, 0);

// Add more controls to the second page

wb_create_control($tab, Label, "This will go to Page 1", $x3, $y3, $w3, $h3, 0, WBC_VISIBLE, 0, 1);
wb_create_control($tab, ComboBox, "This will go to Page 1", $x4, $y4, $w4, $h4, 0, WBC_VISIBLE, 0, 1);

// etc.

Notes

See also

wb_create_control
wb_create_items

Control classes