2.1.25 labelled-menu-item<%>

► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.1 | Windowing Classes

2.1.1 | area<%>
2.1.2 | area-container<%>
2.1.3 | area-container-window<%>
2.1.4 | button%
2.1.5 | canvas<%>
2.1.6 | canvas%
2.1.7 | check-box%
2.1.8 | checkable-menu-item%
2.1.9 | choice%
2.1.10 | clipboard-client%
2.1.11 | clipboard<%>
2.1.12 | combo-field%
2.1.13 | control<%>
2.1.14 | control-event%
2.1.15 | cursor%
2.1.16 | dialog%
2.1.17 | event%
2.1.18 | frame%
2.1.19 | gauge%
2.1.20 | group-box-panel%
2.1.21 | grow-box-spacer-pane%
2.1.22 | horizontal-pane%
2.1.23 | horizontal-panel%
2.1.24 | key-event%
2.1.25 | labelled-menu-item<%>
2.1.26 | list-box%
2.1.27 | list-control<%>
2.1.28 | menu%
2.1.29 | menu-bar%
2.1.30 | menu-item<%>
2.1.31 | menu-item%
2.1.32 | menu-item-container<%>
2.1.33 | message%
2.1.34 | mouse-event%
2.1.35 | pane%
2.1.36 | panel%
2.1.37 | popup-menu%
2.1.38 | radio-box%
2.1.39 | selectable-menu-item<%>
2.1.40 | separator-menu-item%
2.1.41 | scroll-event%
2.1.42 | slider%
2.1.43 | subarea<%>
2.1.44 | subwindow<%>
2.1.45 | tab-panel%
2.1.46 | text-field%
2.1.47 | timer%
2.1.48 | top-level-window<%>
2.1.49 | vertical-pane%
2.1.50 | vertical-panel%
2.1.51 | window<%>

On this page:

enable
get-help-string
get-label
get-plain-label
is-enabled?
on-demand
set-help-string
set-label

Inherited methods:
from menu-item<%>
delete
get-parent
is-deleted?
restore

top← prev up next →

labelled-menu-item<%> : interface?

implements: | menu-item<%>

A labelled-menu-item<%> object is a menu-item<%> with a string label (i.e., any menu item other than a separator). More specifically, it is an instance of either menu-item% (a plain menu item), checkable-menu-item% (a checkable menu item), or menu% (a submenu).

( send a-labelled-menu-item enable enabled?) → void?
enabled? : any/c

Enables or disables the menu item. If the item is a submenu (or menu in a menu bar), the entire menu is disabled, but each submenu item’s is-enabled? method returns #f only if the item is specifically disabled (in addition to the submenu).

( send a-labelled-menu-item get-help-string)
→ ( or/c label-string? false/c)

Returns the help string for the menu item, or #f if the item has no help string.

When an item has a help, the string may be used to display help information to the user.

( send a-labelled-menu-item get-label) → label-string?

Returns the item’s label.

See also set-label and get-plain-label.

( send a-labelled-menu-item get-plain-label) → label-string?

Like get-label, except that &s in the label are removed as described in set-label.

( send a-labelled-menu-item is-enabled?) → boolean?

Returns #t if the menu item is enabled, #f otherwise.

See also enable.

( send a-labelled-menu-item on-demand) → void?

Specification: Normally called when the user clicks on the menu bar containing the item (before the user sees any menu items), just before the popup menu containing the item is popped up, or just before inspecting the menu bar containing the item for a shortcut key binding.

A on-demand in menu-item-container<%> method can be overridden in such a way that the container does not call the on-demand method of its items.

Default implementation: Calls the demand-callback procedure that was provided when the object was created.

( send a-labelled-menu-item set-help-string help) → void?
help : ( or/c label-string? false/c)

Sets the help string for the menu item. Use #f to remove the help string for an item.

( send a-labelled-menu-item set-label label) → void?
label : label-string?

Sets the menu item’s label. If the item has a shortcut, the shortcut is not affected.

If the label contains & and the window is a control, the label is parsed specially; under Windows and X, the character following a & is underlined in the displayed menu to indicate a keyboard mnemonic. Pressing the Alt key with an underlined character from a menu’s name in the menu bar causes the menu to be selected (via on-menu-char). When a menu has the focus, the mnemonic characters are used for navigation without Alt. A && in the label is replaced by a literal (non-navigation) &. Under Mac OS X, &s in the label are parsed in the same way as for X and Windows, but no mnemonic underline is displayed.

A & is always preserved in the label returned by get-label, but never preserved in the label returned by get-plain-label.

For historical reasons, if a label contains a tab character, then the tab and all remaining characters are hidden in the displayed menu.
top← prev up next →