Toolbar control

The Toolbar control lets you add picture buttons to a menu for your PocketBuilder applications. You can control picture size in runtime toolbars by setting the PictureWidth and PictureHeight properties on the Toolbar control. The toolbar shrinks or grows to fit the height, and the toolbar buttons shrink or grow to fit the width and the height you set. Pictures you select for the buttons are automatically scaled to the picture width and height settings.

You add a Toolbar control to a window or user object using the Insert>Control>Toolbar menu item, or by selecting the Toolbar icon in PainterBar1 and clicking inside the window or user object.

You can add toolbar items to the Toolbar control on the Items page of the Properties view for the control. You can also create ToolbarItem objects in script:

ToolbarItem myItem
Integer li_rtn

li_rtn = tlbr_myToolBar.AddPicture ("pic1.bmp")
li_rtn = tlbr_myToolBar.AddPicture ("addwatch!")
tlbr_myToolBar.visible = true
myitem.itemstate = 4myitem.itemgroup = 0myitem.itempictureindex = 1myitem.itemstyle = stylebutton!li_rtn = tlbr_mytoolbar.AddItem(myItem)
myitem.itempictureindex = 2myitem.itemstyle = stylecheck!li_rtn = tlbr_mytoolbar.AddItem(myItem)

Typically you would use the PocketBuilder IDE to add a visual user object, because events that are associated with a visual user object are not available when the object is instantiated in script. Since there are no events on a ToolbarItem object, the only disadvantage to using script to add a toolbar item object is one of convenience; however, tapping an item in a Toolbar control triggers a Clicked event on the control. To take advantage of this Toolbar control event, you must create the Toolbar control in the IDE, even if you add toolbar items in script.

Properties and functions of the Toolbar control and ToolbarItem objects are described in the PowerScript Reference and in the online Help.