Creates a new button and adds it to the Windows Help button bar.
Syntax
CreateButton("button-id", "name", "macro")
CB("button-id", "name", "macro")
Parameter | Description |
button-id | Name that Windows Help uses internally to identify the button. This name must be enclosed in quotation marks. |
name | Text that appears on the button. This name must be enclosed in quotation marks. Within the quotation marks, place an ampersand (&) before the character you want to use for the button’s accelerator key. The button name is case sensitive and can have as many as 29 characters—after which Help ignores any additional characters. |
macro | Help macro or macro string that executes when the user chooses the button. The macro must be enclosed in quotation marks. Separate multiple macros in a string with semicolons (;). |
Example
The following macro creates a new button labeled Ideas that, when chosen, jumps to a topic with the “directory” context string in the IDEAS.HLP file:
CreateButton("btn_ideas", "&Ideas", "JumpId(`ideas.hlp', `directory')")
Notice that the letter I serves as the button’s accelerator key.
Comments
Windows Help allows a maximum of 16 author-defined buttons on the button bar, making a total of 22 buttons, including the Browse buttons. However, designing a button bar with more than seven to nine buttons may cause usability problems.
If more than one button is created with the CreateButton and BrowseButtons macros in the [CONFIG] section of the Help project file, the left-to-right order of the added buttons on the Windows Help button bar is determined by the top-down order of the macros listed in the [CONFIG] section. For example, the following [CONFIG] section adds a Clock button, then the Browse buttons, and then an Exit button to the right of the standard Help buttons:
[CONFIG]
CreateButton("btn_time", "&Clock", "ExecProgram(`clock', 0)")
BrowseButtons()
CreateButton("btn_close", "E&xit", "Exit()")
Windows Help ignores this macro if it is executed in a secondary window.
See Also
BrowseButtons, ChangeButtonBinding, DestroyButton, DisableButton, EnableButton