Next Previous Up Top Contents Index

8.11 DUIM-Gadgets Module

<menu>

Open abstract instantiable class

Summary

The class of menu gadgets.

Superclasses

<gadget> <multiple-child-composite-pane>

Init-keywords

update-callback:

An instance of type false-or(<function>).

owner:
An instance of type <sheet>.

mnemonic:
An instance of type false-or(<character>). Default value: #f.

command:
An instance of false-or(<command>). Default value: #f.

Library

duim-gadgets

Module

duim-gadgets

Description

The class of menu gadgets.

Support for dynamically modifying the contents of a menu is provided in the form of an update callback, If this is supplied using the update-callback: init-keyword, then it is invoked just before the menu is displayed. This callback is free to make changes to the contents of the menu, which will then appear when the update callback is complete. Note that you can also supply an update callback to any menu box which forms a part of the menu, using the relevant init-keyword to <menu-box>.

The owner: argument is used to specify which sheet owns the menu. If you fail to supply this, then the menu will be owned by the entire screen.

The mnemonic: init-keyword is used to specify a keyboard mnemonic for the button. This is a key press that involves pressing the ALT key followed by a number of alphanumeric keys.

The command: init-keyword specifies a command that is invoked when the menu is chosen. For most menus, you should not specify a command; instead, you assign menu buttons as children to the menu, and the menu buttons themselves have commands specified. However, in the rare case where the menu has no children, and you want the menu itself to invoke a command, you can use this init-keyword.

Internally, this class maps into the menu Windows control.

Operations

add-command choose-from-dialog choose-from-menu
display-menu menu-owner

Example

The following code creates a menu, Hello, that contains a single button, World. Notice how using contain creates a menu bar for you automatically. You should note that using display-menu would not have this effect.

*menu* := contain(make(<menu>, 
                       label: "Hello", 
                       children: 
                         vector
                           (make(<menu-button>, 
                                 label: "World"))));

See also

display-menu, page 546

make-menu-from-items, page 610


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index