Style flags

style = flags

Applicable to:
Windows; buttons; button groups; graphics; listboxes; menu items; OLE controls; static text; tables; textboxes, textbox groups

The style = clause consists of a list of flags which determine the appearance, and sometimes the behaviour, of the object when it is created. The flags are all manifest constants listed in the standard include file $SCULPTOR/include/sculptor.h, and all have the prefix WS_. Any combination of flags may be used, and the flags may appear in any order. Not all flags are appropriate for use with all objects; inappropriate flag assignments are ignored. If style flags are assigned both to a group and to an object within the group, these are combined. The object style flags are added to any flags assigned to the group, rather than replacing them. It is not possible to override a group style flag at object level.

If more than one flag is required, they must be separated by the character | e.g.:

style = WS_INDENT | WS_CHECKED

See the style clause documentation for windows and for each object type for details of the style flags available.

The following flags may be used by most window controls:

WS_DISABLED

Create the control disabled. A disabled control cannot be accessed during a dialog, and its label is displayed in faint text. All controls are by default enabled when created, unless this flag is specified. The disable and enable commands are used to disable or enable a control at run time (but have no effect on its initial value).

WS_INVISIBLE

Create the control invisible. The hide and show commands are used to change a control’s visibility at run time (but have no effect on its initial value).

WS_NOTABSTOP

Stop the control from receiving input focus. The TAB and BACKTAB keys skip the control, and a mouse click on it is ignored. The appearance of the control is unchanged. The disable_tabstop command has the same effect as this flag.

WS_CLICKONLY

The control is to be skipped when the user is navigating with the TAB and BACKTAB keys. It may, however, be given focus if the user clicks on it.


Modifying style at run time

As several style flags may be active at any time, the | (bitwise or) and &~ (bitwise and not) operators are used to add and remove flags. Changes to an object’s style should therefore use the constructions:

Adding a style flag
object_id->style = object_id->style | flag [ | flag] …
Removing a style flag
object_id->style = object_id->style &~ (flag [ &~ flag] …)

See Modifying a property at run time.


Retrieving style at run time

Use the following form to test an object for a style flag at run time:

object_id->style &

The bitwise and operator (&) is used rather than the equals to operator (=) because several styles may be set at any one time. The clause evaluates to non-zero (TRUE) if the object has the style flag being tested, otherwise zero (FALSE).

Note the difference between state and style. The state clause is used with a style flag to retrieve the current state of an object. The style clause retrieves the initial style which was used when it was created and is used next time it is created, regardless of the current state of the object.

For example:

object_id->state & WS_DISABLED tests whether an object is currently disabled.

object_id->style & WS_DISABLED tests whether an object is initially created disabled.

See Retrieving a property at run time.

EXAMPLE

if (Win5->style & WS_INVISIBLE) then info \
     "Window will be created invisible"

RELATED TOPICS

Property clauses

Retrieving object state

Window and window object style flags