Element: window.buttons[16]

Type

callback

Description

The command procedures associated with user buttons in a window’s menu bar. The window may have up to 16 buttons.

These elements are shorthand for reference to the exec procedures of panels in the window menubar (window.menubar), where:

window.buttons[n] is shorthand for

window.menubar.panels[n].exec,

but they have the capability of being defined before a window has been allocated, i.e. before the existence of the menu bar.

Buttons are visible in a menu bar within a window if their procedures are defined (not null). The text displayed in the buttons is determined by the values of the window.button_labels elements.

In the case of most window types, the procedures of all 16 buttons are user defined, but some window types (graphic) reserve some buttons for system use. For all windows, button 1, conventionally used as the help button, is displayed at the right of the menu bar. The left most button is therefore button 2 or the first visible button after 2, and the others are displayed in sequence from left to right.

The buttons on a graphic window, invoked by the command wgraphic, are as follows:

Button 2 is initially defined internally as a window repaint. It can be redefined but cannot then be set back to its internal repaint setting. Buttons 1, and 3 through 16 are user controllable. New graphic windows have only button 2 predefined.

For other windows types, buttons 2 through 16 are totally user controllable:

All buttons are user controllable. New windows do not have any buttons predefined.

Parameters

window.buttons[<num>] (<window>,<num>)

Example

win2.buttons[8] = {
    args w=window, butt=numeric
    tell <'Button', butt, 'was selected'>
}