► |  | The Racket Graphical Interface Toolkit

1 | Windowing
2 | Widget Gallery
3 | Windowing Classes
4 | Windowing Functions
5 | Editors
6 | Snip and Style Classes
7 | Editor Classes
8 | Editor Functions
9 | WXME Decoding
10 | Preferences
11 | Dynamic Loading
12 | Startup Actions
13 | Init Libraries
14 | Platform Dependencies
| Index

▼ | 3 | Windowing Classes

3.1 | area<%>
3.2 | area-container<%>
3.3 | area-container-window<%>
3.4 | button%
3.5 | canvas<%>
3.6 | canvas%
3.7 | check-box%
3.8 | checkable-menu-item%
3.9 | choice%
3.10 | clipboard-client%
3.11 | clipboard<%>
3.12 | combo-field%
3.13 | control<%>
3.14 | column-control-event%
3.15 | control-event%
3.16 | cursor%
3.17 | dialog%
3.18 | event%
3.19 | frame%
3.20 | gauge%
3.21 | group-box-panel%
3.22 | grow-box-spacer-pane%
3.23 | horizontal-pane%
3.24 | horizontal-panel%
3.25 | key-event%
3.26 | labelled-menu-item<%>
3.27 | list-box%
3.28 | list-control<%>
3.29 | menu%
3.30 | menu-bar%
3.31 | menu-item<%>
3.32 | menu-item%
3.33 | menu-item-container<%>
3.34 | message%
3.35 | mouse-event%
3.36 | pane%
3.37 | panel%
3.38 | popup-menu%
3.39 | printer-dc%
3.40 | radio-box%
3.41 | selectable-menu-item<%>
3.42 | separator-menu-item%
3.43 | scroll-event%
3.44 | slider%
3.45 | subarea<%>
3.46 | subwindow<%>
3.47 | tab-panel%
3.48 | text-field%
3.49 | timer%
3.50 | top-level-window<%>
3.51 | vertical-pane%
3.52 | vertical-panel%
3.53 | 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 →

interface 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).

> method (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).

> method (send a-labelled-menu-item get-help-string)
> → (or/c label-string? #f)

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.

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

Returns the item’s label.

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

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

Like get-label, except that &s and tab characters in the label are stripped in the same way as for set-label.

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

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

See also enable.

> method (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. See on-demand in menu-item-container<%> for further details.

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.

> method (send a-labelled-menu-item set-help-string help) → void?
> help : (or/c label-string? #f)

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

> method (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; on Windows and Unix, 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) &. On Mac OS, &s in the label are parsed in the same way as for Unix and Windows, but no mnemonic underline is displayed. On Mac OS, a parenthesized mnemonic character is removed (along with any surrounding space) before the label is displayed, since a parenthesized mnemonic is often used for non-Roman languages. Finally, for historical reasons, if a label contains a tab character, then the tab and all remaining characters are hidden in the displayed menu. All of these rules are consistent with label handling in button% and other windows.

A & is always preserved in the label returned by get-label, but never preserved in the label returned by get-plain-label.
top ← prev up next →