Button style

style = flags

Style flags may be assigned to an individual button or to a button group. If style flags are assigned both to a group and to a button within the group, these are combined. The button 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 button level.

The following flags are currently available:

WS_INVISIBLE

Create invisible.

WS_NOTABSTOP

Stop button from receiving input focus.

WS_DISABLED

Create disabled.

WS_CLICKONLY

Only allow the button to receive input focus if the user clicks on it.

WS_CJT
WS_RJT
WS_LJT

For a push button, centre, left-justify or right-justify the label on the button. The default is for label text to be centred.

For a multi-button, the WS_LJT flag can be used to place the button label to the left of the checkbox, rather than to the right (default). WS_CJT has no effect.

WS_CHECKED

Create the button checked. This flag applies to multi buttons only and is ignored if assigned to a push button. In a checkbox group any number of buttons may be created checked, though the default is for all checkbox buttons to be created unchecked. In a radio group, the first button is by default created checked and the others unchecked. This flag may be used to override this by specifying a different button to be created checked. Only one radio button in a group may be checked at any one time.

WS_DEFAULT_BUTTON

Define a push button as the default button for a dialog. The default button is given focus when no other push button in that window has focus. This style, which is also available for OLE controls, may be applied to only one control in any window. The result of assigning it to more than one control is undefined.

WS_CANCEL_BUTTON

Define a push button as the cancel button for a dialog. This style, which is also available for OLE controls, may be applied to only one control in any window. The result of assigning it to more than one control is undefined.

WS_HOTBUTTON

Push buttons only. Specifies that the button’s event function is to be called when the button is pressed, even if the program is not in a dialog. A typical use for this button style is for a cancel button to interrupt a non-interactive operation.

When the button is clicked, the program is interrupted at a random place in the code being executed; great care should be taken, therefore, that no command that could damage the program logic is included in the event function.

A recommended method of using the hot button feature is to use the event function simply to set a flag. The main program, which will typically be looping, can check the value of this flag at a point in the code where it is safe to execute the required action, and execute it if the flag indicates that the hot button has been pressed.

Before the event function is called, Sculptor saves the current values of the variables sys.Error, sys.Errno, sys.Status and sys.Traps. These values are restored after the function returns. However, future versions of Sculptor may save more standard variables, so these should not be used to communicate between the event function and the main code.

If the main program is sleeping when a hot button is clicked, the sleep command will continue for the time remaining to it when the event function returns. The wakeup command with the following form:

wakeup 0

can be used inside the event function to terminate the sleep command.

WS_PLAIN

Image buttons only (push buttons with a value assigned to the image clause). Causes the button to be created with no border or shadow, giving it a flat appearance. Ignored for other button types.

Default: For a button group, or ungrouped button, if the style = clause is omitted, or set to 0, no flags are set. The default for a grouped button is the group style.

See example


RELATED TOPICS

Buttons

Style flags