CONTROL ADD STATUSBAR statement

Purpose

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.

Syntax

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

hDlg

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

id&

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.

txt$

Text to initially display in the StatusBar control.

x,y

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.

xx,yy

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.

style&

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.

%CCS_TOP

The StatusBar is placed at the top of the dialog.

%CCS_BOTTOM

The StatusBar is placed at the bottom of the dialog.

%SBARS_SIZEGRIP

A sizegrip is added to the StatusBar.

%SBARS_TOOLTIPS

Use this style to enable tooltips.

exstyle&

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:

%WS_EX_CLIENTEDGE

Apply a sunken edge border to the control.

%WS_EX_STATICEDGE

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

%WS_EX_WINDOWEDGE

Apply a raised edge border to the control.

callback

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.

Remarks

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, STATUSBAR