A tab-window is a node within a regular window.
It consists of the tab-bar (a row of tab-selectors) at the top, and the
rest of the node which will display different sets of object depending on
which tab that is currently selected.
The tab-bar is limited to one row of tabs (or "selectors"). These
actually works similar to radio-buttons, but looks like "tabs". There
must be at least one tab. Each tab has a text-label.
When the user clicks on a tab, your call-back function associated with
that tab will be invoked (see AddTab). The point is that the call-back
function shall create all the objects corresponding to the tab. The
regular functions for creating objects may be used, which implies the
possibility of nested tab-windows.
If there is not space enough for all the tabs the excess ones will be
clipped, which is not as bad as it seems. However: The main point with
tabs-windows is to make quick access to the different controls, and this
is not not fulfilled anyway if you add too many tabs.
See also:
Windows,
Objects,
Menus,
Containers,
Listboxes.
Creates the node object of the entire tab-selector. Returns object-id.
Return value is the identification key for the entire tab-window
(including the tab bar at the top).
Parameters:
- x1, y1: position for the tab-window
- width, height: the size of the tab-window (may also be ADAPTIVE).
status - should point to a variable that contains the index of the
currently selected tab starting with 0 for the leftmost one. May be
used by your program to restart anther time with the same selection
as when closing.
See also:
AddTab.
int AddTab(int id, void (*callback)(void *data, int id), void *data,
const char *label);
Adds one tab into the bar of tabs in a tab-window. The callback, which is
a function you must code, will be called when the tab is clicked by the
user or initially by DisplayWindow(). The callback is not supposed to
open a new window. The only thing it shall bother about is to create the
objects for the tab-subwindow. This has always been cleaned before
callback is invoked (i.e the objects created by a previous selection has
been removed before call). The callback shall not refresh the objects in
the tab-window, this will also be done automatically after return.
All objects created by the callback will be but in the tab-window.
If absolute co-ordinates are used for such objects (x,y) these shall
refer to the upper left corner of the free area in the tab-window.
Like other objects tabs may be added also after the window has been built
with a call to DisplayWin. The same applies to removal of tabs.
Parameters:
- id: is the id-code previously returned by CreateTabWindow
- label: is the text to display on the tab
- data: is a pointer to any data that you want to be passed to the
callback when time has come for its call.
- callback: is a pointer to a function that you shall write. It will
be called when it is time to create the objects that you want to be
shown when the user clicks this certain tab. Parameters to the
callback: "data" see above, "id" the identity to the tab itself
(not the container with the objects). Removing the tab will also
remove the container of the tab if it happens to be selected.
See also:
DisplayWin,
CreateTabWindow.
void HookLeaveTab(void (*callback)(void *data), void *data);
This function registers 'callback' to be a function that will be called
with 'data' when a tab in a tab-window is left. The tab will be left
either because the user selects some other tab in the same tab-window or
because the entire window is closed.
HookLeaveTab must be called when generating the tab-window (i.e. by the
function installed by 'AddTab'), only at this stage the tab-window is
prepared to receive such a call.
The purpose is to give your program the possibility to release memory
that you needed to allocate for the objects in the tab-window.
See also:
AddTab.
Back to contents