IupTabs

IUP - Portable User Interface

IupTabs

Creates a Tabs element. Allows a single dialog to have several screens, grouping options. The grouping is done in a single line of tabs arranged according to the tab type. It inherits from IupCanvas.

This is an additional control that depends on the CD library. It is included in the Controls Library.

It contains a IupZbox to control the groups of controls. The IupZbox is a child of the IupCanvas, so all the attributes set in the Tabs will affect its child by attribute inheritance.

Creation

Ihandle* IupTabs(Ihandle* elem, ...); [in C]
Ihandle* IupTabsv(Ihandle** elems); [in C]
iup.tabs{elem, ...: ihandle} -> (elem: ihandle) [in Lua]
tabs(elem, ...) [in LED]

elem, ... : List of the elements that will be placed into Tabs.

This function returns the created Tabs's identifier, or NULL if an error occurs. NULL defines the end of the list in C.

Attributes

ALIGNMENT: In this case it is propagated to the Zbox when changed (ALIGMENT is one of the attributes that are not inherited from the parent). See the IupZbox documentation.

TABTITLE: Contains the text to be shown in the tab's title. If this value is NULL, it will remain empty. This attribute is used only in the elements contained in the tab.

TABTYPE: Indicates the type of tab, which can be one of the following:

"TOP", "BOTTOM", "LEFT" or "RIGHT". Default is "TOP".

TABORIENTATION: Indicates the orientation of tab text, which can be one of the following:

"HORIZONTAL" or "VERTICAL". Default is "HORIZONTAL".

FONT: Indicates the font to be used in the internal tab text. 

FONT_ACTIVE: Indicates the font to be used when the tab is selected. 

FONT_INACTIVE: Indicates the font to be used when the tab is inactive. 

TABSIZE: Contains the text width of a single tab in pixels. If this value is NULL, the tab will be shown with the smallest possible value that fits its title. This size can refer to the whole IupTabs, thus affecting all tabs, or to a specific tab child. If both are defined, the size of the tab child will have priority over the global IupTabs size.

VALUE: Changes the active tab. The value passed must be the name of one of the elements contained in the tabs. Default: the first element.  To set the name of an element, use the IupSetHandle function. In Lua you can also use the element reference directly.

ACTIVE: Allows or inhibits user interaction with a given tab. When the attribute is "NO", the corresponding tab modifies the text color to show that interaction is inhibited. Be careful, because a "REPAINT" may be needed to generate a Tabs repaint.

REPAINT: This attribute immediately generates a Tabs repaint.

Callbacks

TABCHANGE_CB: Callback called when the user shifts the active tab. The parameters passed are:

int function(Ihandle* self, Ihandle* new_tab, Ihandle* old_tab); [in C]
elem:tabchange_cb(new_tab, old_tab: ihandle) -> (ret: number) [in Lua]

self: Ihandle* of the control
new_tab: Ihandle* of the tab selected by the user
old_tab: Ihandle* of the previously selected tab

If returns IUP_IGNORE the tab is not changed.

Notes

The Tabs elements, differently from a ZBOX, does not need to have associated names. Those without a name will receive an automatically generated one.

When you change the active tab the focus is not changed. If you want to control the focus behavior call IupSetFocus in the TABCHANGE_CB callback.

Examples

Browse Example Files

iuptabs.gif

See Also

IupCanvas