of_addButton

Description

Adds a button to the toolbar.

Syntax

of_addButton(String name, {String image}, {String toolTip}, {Integer position})

Parameter(s)

Name Type Description
name String The name of the button to be added. The name is also the text displayed for a toolbar button when display text is enabled
image String The name of the image file to be displayed for the button. This parameter is optional and has no default value. The valid fileTypes are GIF, PNG, JPG, BMP, WMF and RLE. Support for PB internal pictures has been added, i.e. Open!, Comment!, etc.
toolTip String The text to be used when displaying the button's toolTip. This parameter is optional and defaults to the button's name
position Integer Indicates which "side" of the toolbar to which the button is to be anchored. Values allowed for this parameter are LEFT (1) and RIGHT (2). This parameter is optional and the default value is LEFT

Return Value

Returns a long containing the index of the item.

Usage

While the name parameter is NOT optional, it can have an empty value. When the name is empty, the program assigns the name using "ToolBarItem" + String(item), i.e. if the item is the 3rd item added the name will be "ToolBarItem_3".

Another consideration when using this method is that when using the RIGHT position, buttons are added from right-to-left, like a pop stack. When buttons are added using the LEFT position, they are added left-to-right.

Examples

of_addButton('',     'open.bmp',     LEFT)
of_addButton('Save', 'save.bmp',     LEFT)
of_addButton('Exit', 'powerOff.bmp', 'Close the window', RIGHT)


Doc_1.jpg

of_addButton('Exit', 'powerOff.bmp', 'Close the window', RIGHT)
of_addSeparator(RIGHT)
of_addButton('Save', 'save.bmp',     RIGHT)
of_addButton('',     'open.bmp',     RIGHT)


Doc_2.jpg

See Also

Last edited Sep 28, 2016 at 12:25 PM by cjharris02892, version 5