Difference between revisions of "Tabset"
From uGFX Wiki
(→Example) |
|||
Line 3: | Line 3: | ||
== API Reference == | == API Reference == | ||
The API reference of the Tabset can be found [http://api.ugfx.org/master/group___tabset.html here]. | The API reference of the Tabset can be found [http://api.ugfx.org/master/group___tabset.html here]. | ||
+ | |||
+ | == Border == | ||
+ | The tabset can optionally be rendered with a border around the client area. To enable the border, GWIN_TABSET_BORDER has to be passed as a flag to the ''gwinTabsetCreate()'' routine. | ||
== Example == | == Example == |
Revision as of 18:02, 27 June 2015
The tabset is a special container widget that manages different tabs. It is pretty much like the tabs in your web browser.
API Reference
The API reference of the Tabset can be found here.
Border
The tabset can optionally be rendered with a border around the client area. To enable the border, GWIN_TABSET_BORDER has to be passed as a flag to the gwinTabsetCreate() routine.
Example
The following example shows how to create a tabset with three pages and adding different widgets to each page.
#include "gfx.h" GListener gl; GHandle ghTabset; GHandle ghPage1, ghPage2, ghPage3; GHandle ghLabel1, ghLabel2, ghLabel3; static void createWidgets(void) { GWidgetInit wi; // Apply some default values for GWIN gwinWidgetClearInit(&wi); wi.g.show = TRUE; // Create the Tabset wi.g.width = 200; wi.g.height = 200; wi.g.x = 10, wi.g.y = 10; ghTabset = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER); ghPage1 = gwinTabsetAddTab(ghTabset, "Page 1", FALSE); ghPage2 = gwinTabsetAddTab(ghTabset, "Page 2", FALSE); ghPage3 = gwinTabsetAddTab(ghTabset, "Page 3", FALSE); // Add some widgets to Page 1 wi.g.width = 120; wi.g.height = 20; wi.g.x = 10; wi.g.y = 10; wi.g.parent = ghPage1; wi.text = "This is page Nr. 1"; ghLabel1 = gwinLabelCreate(0, &wi); // Add some widgets to Page 2 wi.g.width = 120; wi.g.height = 20; wi.g.x = 10; wi.g.y = 50; wi.g.parent = ghPage2; wi.text = "This is page Nr. 2"; ghLabel2 = gwinLabelCreate(0, &wi); // Add some widgets to Page 3 wi.g.width = 120; wi.g.height = 20; wi.g.x = 10; wi.g.y = 90; wi.g.parent = ghPage3; wi.text = "This is page Nr. 3"; ghLabel3 = gwinLabelCreate(0, &wi); } int main(void) { GEvent* pe; // Initialize the display gfxInit(); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); gdispClear(White); // create the widget createWidgets(); // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); (void)pe; } return 0; }