IupTabs (since 3.0)

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. Also known as Notebook in native systems.

Creation

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

child, ... : List of the elements that will be placed in the box. NULL must be used to define the end of the list in C. It can be empty.

Returns: the identifier of the created element, or NULL if an error occurs.

Attributes

BGCOLOR: In Windows and in GTK when in Windows, the tab buttons background it will be always defined by the system. In Windows the default background is different from the dialog background. Default: the global attribute DLGBGCOLOR.

EXPAND (non inheritable): The default value is "YES".

FGCOLOR: Tabs title color. Default: the global attribute DLGFGCOLOR.

MULTILINE [Windows Only] (non inheritable): Enable multiple lines of tab buttons. This will hide the tab scroll and fits to make all tab buttons visible. Can be "YES" or "NO". Default "NO". It is always enabled when TABTYPE=LEFT or TABTYPE=RIGHT. (since 3.0)

PADDING (non inheritable): internal margin of the tab title. Works just like the MARGIN attribute of the IupHbox and IupVbox containers, but uses a different name to avoid inheritance problems. Default value: "0x0". (since 3.0)

SIZE (non inheritable): The default size is the smallest size that fits its largest child. All child elements are considered even invisible ones.

TABIMAGEn (non inheritable): image name to be used in the respective tab. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage. In Motif, the image is shown only if TABTITLEn is NULL. In Windows and Motif set the BGCOLOR attribute before setting the image. (since 3.0)

TABORIENTATION (non inheritable): Indicates the orientation of tab text, which can be "HORIZONTAL" or "VERTICAL". Default is "HORIZONTAL". VERTICAL is supported only in GTK and in Windows. In Windows, VERTICAL is only supported when TABTYPE=LEFT or TABTYPE=RIGHT. (GTK 2.6)

TABTITLEn (non inheritable): Contains the text to be shown in the respective tab title. If this value is NULL, it will remain empty. (since 3.0)

TABTITLE (non inheritable) (at children): Same as TABTITLEn but set in each child. Works only before the child is added to the tabs. Deprecated, use TABTITLEn.

TABTYPE (non inheritable) (creation only in Windows): Indicates the type of tab, which can be "TOP", "BOTTOM", "LEFT" or "RIGHT". Default is "TOP". In Windows, if LEFT or RIGHT, then MULTILINE=YES and TABORIENTATION=VERTICAL always. In Windows, when not TOP, then visual style is removed from tabs.

VALUE (non inheritable): Changes the active tab by its name. The value passed must be the name of one of the elements contained in the tabs. Use IupSetHandle or IupSetAttributeHandle to associate a child to a name. In Lua you can also use the element reference directly.

VALUE_HANDLE (non inheritable): Changes the active tab by its handle. The value passed must be the handle of a child contained in the tabs. When the tabs is created, the first element inserted is set as the visible child. (since 3.0)

VALUEPOS (non inheritable): Changes the active tab by its position, starting at 0. When the tabs is created, the first element inserted is set as the visible child. (since 3.0)


ACTIVE, FONT, X, Y, POSITION, CLIENTSIZE, MINSIZE, MAXSIZE, WID, RASTERSIZE, ZORDER, VISIBLE: also accepted.

Callbacks

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

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

ih: identifier of the element that activated the event.
new_tab: the new tab selected by the user
old_tab: the previously selected tab


MAP_CB, UNMAP_CB, GETFOCUS_CB, KILLFOCUS_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB, K_ANY, HELP_CB: All common callbacks are supported.

Notes

The Tabs can be created with no children and be dynamic filled using IupAppend.

The ENTERWINDOW_CB and LEAVEWINDOW_CB callbacks are called only when the mouse enter or leaves the tabs buttons area.

The Tabs children, differently from a IupZbox, automatically receives a name if does not already have one when it is appended to the tabs in the native system. Also IupTabs does NOT depends on the VISIBLE attribute.

In GTK, when the tabs buttons are scrolled, the active tab is also changed.

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

Examples

Browse for Example Files

In Windows, the Visual Styles work only when TABTYPE is TOP.

Windows
Classic
Windows
XP Style

GTK is the only one that supports vertical text in the TOP configuration, but does not supports multiple lines of tab buttons.

GTK

Motif does not supports vertical text.

Motif