Add a Tab Control to a dialog.  A Tab Control is analogous to the dividers in a notebook.  It displays one particular page, selecting it from multiple pages, when the user chooses the corresponding tab.


CONTROL ADD TAB, hDlg, id&, txt$, x, y, xx, yy [, [style&] [, [exstyle&]]] [[,] CALL callback]


Handle of the dialog in which the Tab Control will be created.  The dialog will become the parent of the control.


Unique identifier for the control in the range 1 to 65535, frequently specified with numeric equates for clarity of the code.  For example, the equate %PickList is more informative than a literal value such as 497. Best practice suggests identifiers should start at 100 to avoid conflict with any of the standard predefined identifiers.


Text to associate with the Tab Control. A Tab Control does not display this text, so it is common to set this value to a null, empty string literal ("").


Integral expressions, variables, or numeric literal values specifying the location of the control inside the dialog client area.  x is the horizontal position, and y is the vertical position.  0,0 refers to the upper left corner of the dialog box client area.  Coordinates are specified in the same terms (pixels or dialog units) as the parent dialog.


Integral expressions, variable, or numeric literal values, specifying the width and height of the control. xx is the width and yy is the height, given in the same terms (pixels or dialog units) as the parent dialog.


Primary style of the Tab control.  The default Tab style is %WS_CHILD and %WS_TABSTOP. This default style is used if both the primary and extended style parameters are omitted from the statement, as in the following example:

CONTROL ADD TAB, hDlg, id&, "",90,90,200,90, , , CALL PBCallback()

If you include explicit style values, they replace the default values. That is, they are not added to the default styles values - your code must specify all necessary primary and extended style parameters.

The primary style value can be a combination of the standard window values, and the values specific to a Tab Control (below), which are combined together with the OR operator to form a bitmask:


Icons are forced to the left


Labels are forced to the left


All tabs are the same size


Tabs are not stretched


Tabs receive the focus when clicked


Parent window is responsible for drawing tabs


A Tooltip control is associated with the control


Tab never receives the focus


Extended style of the control.  The value can be a combination of the values below, combined together with the OR operator to form a bitmask:


Apply a sunken edge border to the control.


Apply a three-dimensional border style to the control (intended to be used for items that do not accept user input).


Apply a raised edge border to the control.


Optional name of a Callback Function that receives all %WM_COMMAND and %WM_NOTIFY messages for the control. See the #MESSAGES metastatement to choose which messages will be received. If a callback for the control is not designated, you must create a dialog Callback Function to process messages from your control.

If the Callback Function processes a message, it should return TRUE (non-zero) to prevent the message being passed unnecessarily to the dialog callback (if one exists).  The dialog callback should also return TRUE if the notification message is processed by that Callback Function.  Otherwise, the DDT engine processes unhandled messages.


When a Callback Function receives a %WM_COMMAND message, it should explicitly test the value of CB.CTL and CB.CTLMSG to guarantee it is responding appropriately to the notification messages.

See also

Dynamic Dialog Tools, CONTROL SET FONT, TAB