Release Notes > 12.1.0.0 > Updates in This Release > JavaScript Toolbars > Toolbars
  
Toolbars
Introduction
The fToolbar object represents an individual toolbar. The fApplication object has methods to manage toolbars, so refer to that section for information about how to use those methods. This section looks at the fToolbar object itself and how that can be used.
Toolbar Properties
The fToobar object has a number of properties which reflect some (but not all) of the values which are representations of the values Layout Developer shows in the toolbars dialog:
fToolbar.name is the name of the toolbar which is assigned when the toolbar is created. This cannot be changed.
fToolbar.display represents the ‘Show’ property in the dialog. The allowed values are listed on the fToolbar.DisplayType constant and are:
fToolbar.DISPLAY_TEXT — show only the text value of the action
fToolbar.DISPLAY_ICONS — show only the icon associated with the action
fToolbar.DISPLAY_TEXT_ICONS — show both text and icons
fToolbar.gap sets the gap between the items in the toolbar
fToolbar.location specifies the ‘Side’ value from the dialog. The allowed values are listed on the fToolbar.LocationType constant and are:
fToolbar.LOCATION_TOP — show the toolbar at the top of the UI
fToolbar.LOCATION_BOTTOM — show the toolbar at the bottom of the UI
fToolbar.LOCATION_LEFT — show the toolbar on the left of the UI
fToolbar.LOCATION_RIGHT — show the toolbar on the right of the UI
If more than one toolbar is given the same location, they will be stacked in the order they are applied
fToolbar.margin is the margin applied to the toolbar edges
fToolbar.wrap is a boolean value property which indicates whether the toolbar should be allowed to wrap if there are too many items to fit into the UI
The items which appear on the toolbar are provided in a list as the fToolbar.items property. This property will return an array of fToolbarItem objects.
The final property is a default action for the toolbar. This is provided as a safety net in case the icons on the toolbar do not have an action associated with them. If they do not, then when clicked the toolbar’s action will be executed instead.
Managing Toolbar Items
As mentioned above, the fToolbar object can provide a list of the items which appear on the toolbar through the fToolbar.items property. The fToolbar object provides methods for managing the items which appear on it. They are:
fToolbar.clear() — this method will clear all items from the toolbar. It is a good idea to clear the items before reconstructing the toolbar
fToolbar.addItem() — this method will add the specified toolbar item (one of fToolbarAction, fToolbarSpace, fToolbarText, fToolbarFill) to the toolbar
fToolbar.removeItem() — will remove the specified toolbar item from the toolbar