Programming with Reflection

image\rwnprg32.gif DefineToolbarButton method

 

Syntax object.DefineToolbarButton ToolbarName, Index, Separator, SmallPictureFile, SmallPicIndex, LargePictureFile, LargePicIndex, Label, Tip, Help, Commands

 

Description

Defines a button on the specified toolbar.

Arguments

ToolbarName Argument type: String
The name of the toolbar you want to edit. Toolbar names are not case sensitive. The default toolbar names are:
 Standard
 File Transfer
 Visual Basic
 Setup

 Use NewToolbar to create a new toolbar.

Index Argument type: Integer
Toolbar buttons are numbered using an index of 1 for the leftmost or top button, and so on. If you use an index value of 0, a new button is inserted at the beginning of the toolbar. If you use an index value greater than the number of existing buttons, a new button is inserted at the end of the toolbar. If you use an index value that corresponds to an existing button, the new button is inserted at this location and the existing button and all subsequent buttons are moved over one position.

Separator Argument type: Boolean
If the value of this argument is rcYes, a separator is inserted between this button and the button to its left. If the value is rcNo, no separator is used and the new button is grouped with the previous button.

SmallPictureFile Argument type: String
The name (and path) of a picture file. This picture appears on the button when small toolbar buttons are selected. (Use ShowToolbarLarge to control button size.) This string can be up to 260 characters long. If this value is an empty string (""), you can specify a predefined button image using SmallPicIndex.

 If you don't want any picture on the button, use "" for this argument and zero (0) for SmallPicIndex.

SmallPicIndex Argument type: Enumeration
Identifies one of Reflection's predefined button images. Click here for more information. If you don't want a picture on the button, use zero (0 or rcBmpNone) for this argument and an empty string ("") for SmallPictureFile.

LargePictureFile Argument type: String
The name (and path) of a picture file. This picture appears on the button when large toolbar buttons are selected. (Use ShowToolbarLarge to control button size.) This string can be up to 260 characters long. If this value is an empty string (""), you can specify a predefined button image using LargePicIndex.

 If you don't want any picture on the button, use "" for this argument and zero (0 or rcBmpNone) for LargePicIndex.

LargePicIndex Argument type: Enumeration
Identifies one of Reflection's predefined button images. Click here for more information. If you don't want a picture on the button, use zero (0 or rcBmpNone) for this argument and an empty string ("") for LargePictureFile.

Label Argument type: String
The label text for this button. (Use ShowToolbarLabels to control whether or not this label text is visible.) This argument can be up to 40 characters long. Reflection automatically resizes buttons to accomodate the label length.

Tip Argument type: String
This text appears when you position the mouse pointer over this button. This argument can be up to 80 characters long.

Help Argument type: String
This text is visible in the status bar or title bar when you hold down the left mouse button over this button. This string can be up to 120 characters long, although the number of characters actually visible is likely to be somewhat less, depending on the size of the window.

Commands Argument type: String
The Reflection method, or sequence of methods, to be executed when the button is clicked. Methods that return values can't be used. Use a space to separate multiple methods. Use double quotation marks around string arguments. For example, the following strings are all valid for this argument:

      "Connect"

      "TransmitAnsi ""Hello"" TransmitTerminalKey rcIBMEnterKey"

      "RunMacro ""MyMacro"", """""

 This string can be up to 260 characters long.

 

Tip:

You can use the macro recorder to help you create procedures to define toolbar buttons. If you turn on the recorder and then configure new toolbar buttons (using the Toolbar Setup dialog box), the recorded procedure will include commands for all currently configured buttons in the toolbar you are modifying, as well as any new buttons you configure.

Note: The older DefineButton method is still available. It cannot configure all currently supported button features, and it only allows you to update the Standard toolbar.

 

image\jump.gif Example

image\jump.gif Keyword Index

image\popup.gif Related Topics

image\popup.gif Reflection products that use this command