presents a simple button:
A Button item can be easily added to the toolbar with the help of the addButton method:
myToolbar.addButton(id, pos, text, imgEnabled, imgDisabled);
Parameters that should be passed are:
Related sample: Button creation
To hide/show any button the user should pass button's id to the following methods:
myToolbar.showItem(id);
myToolbar.hideItem(id);
The user has the possibility to check whether any button is visible. The method returns true if the button is visible:
var isVisible = myToolbar.isVisible(id); // returns true/false
Related sample: Button manipulation
Any button in the toolbar can be enabled/disabled by user:
myToolbar.enableItem(id);
myToolbar.disableItem(id);
Also the user has the possibility to check whether any button is enabled. This can be done by calling the following method:
var isEnabled = myToolbar.isEnabled(id); // returns true/false
The user should pass id of the button that will be checked. The method returns true if the button is enabled, and false if it's disabled.
The user can set any button's text/label. This button's id and text of button's label are passed as parameters to the following method:
myToolbar.setItemText(id, text);
The user can get button's text using getItemText method. The method returns the current title text of the button:
var text = myToolbar.getItemText(id); // returns current item's text
Any button in the toolbar can have its own image displayed in the button display area. setItemImage and setItemImageDis methods allow user to set image to a button by passing the following parameters:
myToolbar.setItemImage(id, url);
myToolbar.setItemImageDis(id, url);
Button's image whether for the enabled or the disabled state can be easily removed/cleared by using the clearItemImage and clearItemImageDis methods to which the user should pass button's id:
myToolbar.clearItemImage(id);
myToolbar.clearItemImageDis(id);
The user can specify the supplementary information regarding any button in the toolbar via the setItemToolTip method. It takes the following parameters:
myToolbar.setItemToolTip(id, tip);
The following method can return the current button's tooltip text:
var tip = myToolbar.getItemToolTip(id); // returns current button's tooltip text
Related sample: Button tooltip
Back to top