The text windows, the Unicode windows and the graphic windows support a toolbar. By default the toolbar may be visible or not, and empty or not. You can suppress the default items that it may contain, and add yours: buttons and menus. You can also use the toolbar to display a message.
-
To toggle the toolbar's visibility on and off use the «class ToVi» ("Toolbar Visible") property.
-
The class of the widgets that the windows' toolbar support is toolbar item.
-
To suppress the existing toolbar items use delete. The script below will delete all toobar items of the window w.
try
repeat
delete toolbar item 1 of w
end repeat
end try
-
To have the toolbar display a message, use the message bar property.
set message bar of window 1 to "Connecting, please wait ..."
The first time, this will really create a new toolbar item.
-
To make a new button in the toolbar, provide a menu command property when creating the toolbar item. The value of menu command should be a string of four characters. This is the string that the window's script will receive in the do menu event when the user clicks the button.
make new toolbar item at window 1 with properties {name:"Upload", menu command:"UpLd"}
-
To make a new pop-up menu in the toolbar, provide a menu property when creating the toolbar item. The value of menu should be a list of strings (of any sizes). These are the strings that the window's script will receive in the do menu event when the user selects a menu item in the menu.
make new toolbar item at window 1 with properties {name:"mail", menu:{"check", "send"}}
The ignore meta property of a toolbar item specifies whether it should take meta-characters in the menu into account.
-
To make a vertical separator, make a new toolbar item with the following special name.
make new toolbar item at window 1 with properties {name:"com.apple.hitoolbox.toolbar.separator"}
Import all snippets
To handle the user's actions in the toolbar items, provide a do menu handler in the script of the window. For more details about programming a do menu handler see the page below.
|