Add a StatusBar control to a dialog.  A StatusBar is a horizontal window, typically at the bottom of a dialog client area, which displays various kinds of status information.  It can be divided into parts to display multiple items.


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


Handle of the dialog in which the StatusBar 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 initially display in the StatusBar control.


Integral expressions to specify control location.  In the case of a StatusBar, location parameters are ignored since the control is placed on the top or the bottom of the dialog, based upon the chosen style. These location parameters are usually defined as 0, 0.


Integral expressions to specify control size.  In the case of a ToolBar, size parameters are ignored since the control is created with a default size.  These size parameters are usually defined as 0, 0.


Primary style of the StatusBar control.  The default StatusBar style is %CCS_BOTTOM.  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 STATUSBAR, hDlg, id&, "", 5, 5, 5, 5, , , CALL SBCallback()

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 StatusBar is placed at the top of the dialog.


The StatusBar is placed at the bottom of the dialog.


A sizegrip is added to the StatusBar.


Use this style to enable tooltips.


Extended style of the StatusBar control.  The extended StatusBar style 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