Toolbar

Toolbars are used to launch macros, files, and to execute any other commands. Toolbar syntax is identical to pop-up menu syntax, except that toolbars cannot contain submenus.

 

A toolbar can be free or associated with a window. If a toolbar is associated with a window, that window becomes owner of the toolbar. It means that the toolbar always is on top of that window; it is hidden when the window is minimized or hidden; it is destroyed when the window is destroyed; it follows the window (optionally) when the window is moved or resized. A toolbar can have multiple instances, associated with multiple instances of the same window or even with different windows. A single window can have several different toolbars associated with it.

 

A toolbar can be associated with a window in two ways:

 

1. Assign a window trigger. For example, if toolbar's trigger is "Notepad" window, then, when Notepad window appears, the toolbar is automatically shown and associated with it. When you close Notepad, the toolbar is destroyed.

 

2. Launch the toolbar using the mac command or command line, and specify the window as command. Examples:

 

mac "Bar" "Calc" ;;associate toolbar "Bar" with "Calc" window; use window name
int h=win("Calc"); mac "Toolbar9" h ;;use window handle
mac "Bar" "''Calc'' ''SciCalc'' ''CALC'' 2" ;;like with the win function

 

If toolbar is launched using some other way, it isn't associated with any window. Such toolbar is always on top.

 

Macro, launched from a toolbar, receives the toolbar window handle in the _command variable. Use val(_command) to get it. The mac function, when it launches a toolbar, returns the toolbar window handle (even if the toolbar was already running).

 

Tips

Move toolbar: drag with the mouse right button.

Move or delete a button: Shift+drag.

Add a button to run macro, file or open Internet link: drag and drop. Ctrl can be used for shortcuts.

If you drag and drop a file onto a program icon, you can choose to open the file in that program.

Right click toolbar to view context menu.

Don't show text of some buttons: insert tab at the beginning of line. You still will be able to see tooltips.

 

See also: Quick Start, toolbar right-click menu toolbar properties extended toolbars DynamicToolbar