of_addItem

Description

Adds an item (button) to the toolbar.

Syntax

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

Parameter(s)

Name Type Description
name String The name of the item (button) to be added. The name is also the text displayed for a toolbar item when display text is enabled
image String The name of the image file to be displayed for the item. 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 item's toolTip. This parameter is optional and defaults to the item's name
position Integer Indicates which "side" of the toolbar to which the item 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, items are added from right-to-left, like a pop stack. When items are added using the LEFT position, they are added left-to-right.

This method is maintained for backward compatibility with previous versions of the toolBar. Its use has been superceded by of_addButton.

Examples

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


Doc_1.jpg

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


Doc_2.jpg

See Also

Last edited Sep 24, 2016 at 1:55 PM by cjharris02892, version 24