Adding and Removing Buttons

Buttons are displayed on the button bar. When the user chooses a button, Help runs the macro associated with the button. You can add as many as 22 buttons to the button bar, although your users might find it difficult to use a button bar containing more than seven to nine buttons.

Help automatically sizes buttons to fit the text displayed on the button. You can’t control the width of the buttons. You can have as many as 29 characters of text on a button.

Creating Buttons

Help provides the CreateButton macro for adding a new button to the button bar. The CreateButton macro has the following syntax:

CreateButton("button_id", "button_text", "macro")

For example, the following macro creates an Options button:

CreateButton("btn_options", "&Options", "JumpId(`current.hlp', `option1_id')")

The button is added to the button bar after the standard buttons in the order that it is listed in the [CONFIG] section of the Help project file. For example, the Options button might be added before the Browse buttons and an “Exit” button:

[CONFIG]
CreateButton("btn_options", "&Options", "JumpId(`current.hlp', `option1_id')")
BrowseButtons()
CreateButton("E&xit", "Exit()")

Figure 13.4 shows the resulting button bar:

Removing Buttons

To remove a button, use the following macro:

DestroyButton("button_id")

For example, to remove the Options button, you use the following macro:

DestroyButton("btn_options")