Using the button routines

On Windows systems, you can add buttons to a window, list, or tab set. Buttons are a standard way of enabling users to terminate input (OK and Cancel buttons are typical examples) or signify that any action should take place. Note the following:

Except for %B_INFO, these button routines can be used only for buttons on a window or tab set. For buttons on a list, see L_BUTTON, L_BUTTONSET, and %L_BUTTONSTATE.

Creating buttons

To create buttons, use the .BUTTON script command or, to create them at runtime, use B_BUTTON, IB_BUTTON, or L_BUTTON.

Defining button placement and the default button

You can define a button set’s location within a window (bottom or right), its justification, the maximum number of buttons per row or column, and the default button. To do this, use the .BUTTON_SET script command or, at runtime, use B_BUTTONSET, IB_BUTTONSET, or L_BUTTONSET. (To define a button’s location in the button set, use B_BUTTON.)

Enabling and disabling buttons

In general, the buttons for a window are enabled when the window is being processed, and they are disabled when the window is not being processed. (For details and exceptions, see the .BUTTON Discussion.)

To enable or disable a button, use %B_ENABLE and %B_DISABLE for buttons on windows and tab sets. Use %L_BUTTONSTATE for buttons on lists. For information on how buttons can be automatically enabled and disabled, see the .BUTTON Discussion.

Modifying and deleting buttons

To modify a button on a window or tab set, use the DSB_MODIFY subfunction of %B_BUTTON. For buttons on lists, use the DSB_MODIFY subfunction of %L_BUTTON.

To delete a button on a window or tab set, use the DSB_DELETE subfunction of %B_BUTTON. For buttons on lists, use the DSB_DELETE subfunction of %L_BUTTON.

Getting information on buttons

You can get information on buttons and button sets for a window, tab set, or list by using %B_INFO. This function has subfunctions that return the number of buttons, the index for the default button, the enabled state of a button, method information, and so forth. See %B_INFO.