► |  | 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:

command
get-shortcut
get-shortcut-prefix
set-shortcut
set-shortcut-prefix

Inherited methods:
from labelled-menu-item<%>
enable
get-help-string
get-label
get-plain-label
is-enabled?
on-demand
set-help-string
set-label
from menu-item<%>
delete
get-parent
is-deleted?
restore

top ← prev up next →

selectable-menu-item<%> : interface?

implements: | labelled-menu-item<%>

A selectable-menu-item<%> object is a labelled-menu-item<%> that the user can select. It may also have a keyboard shortcut; the shortcut is displayed in the menu, and the default on-subwindow-char method in the menu’s frame dispatches to the menu item when the shortcut key combination is pressed.

( send a-selectable-menu-item command event) → void?
event : ( is-a?/c control-event% )

Invokes the menu item’s callback procedure, which is supplied when an instance of menu-item% or checkable-menu-item% is created.

( send a-selectable-menu-item get-shortcut )
→ ( or/c char? symbol? false/c )

Gets the keyboard shortcut character or virtual key for the menu item. This character or key is combined with the shortcut prefix, which is reported by get-shortcut-prefix.

If the menu item has no shortcut, #f is returned.

The shortcut part of a menu item name is not included in the label returned by get-label.

For a list of allowed key symbols, see get-key-code in key-event%.

( send a-selectable-menu-item get-shortcut-prefix )
→ ( listof ( one-of/c 'alt 'cmd 'meta 'ctl 'shift 'option))

Returns a list of symbols that indicates the keyboard prefix used for the menu item’s keyboard shortcut. The allowed symbols for the list are the following:

- 'alt – Meta (Windows and X only)

- 'cmd – Command (Mac OS X only)

- 'meta – Meta (X only)

- 'ctl – Control

- 'shift – Shift

- 'option – Option (Mac OS X only)

Under X, at most one of 'alt and 'meta can be supplied; the only difference between 'alt and 'meta is the key combination’s display in a menu.

The default shortcut prefix is available from get-default-shortcut-prefix.

The shortcut key, as determined by get-shortcut, matches a key event using either the normally reported key code or the other-Shift/AltGr key code (as produced by get-other-shift-key-code in key-event%, etc.). When the shortcut key is a key-code symbol or an ASCII letter or digit, then the shortcut matches only the exact combination of modifier keys listed in the prefix. For character shortcuts other than ASCII letters and digits, however, then the shortcut prefix merely determines a minimum set of modifier keys, because additional modifiers may be needed to access the character; an exception is that, under Windows or X, the Alt/Meta key press must match the prefix exactly (i.e., included or not). In all cases, the most precise match takes precedence; see map-function in keymap% for more information on match ranking.

An empty list can be used for a shortcut prefix. However, the default on-menu-char in frame% method checks for menu shortcuts only when the key event includes either a non-Shift modifier or a Function key. Thus, an empty shortcut prefix is normally useful only if the shortcut key is a Function key.

( send a-selectable-menu-item set-shortcut shortcut) → void?
shortcut : ( or/c char? symbol? false/c )

Sets the keyboard shortcut character for the menu item. See get-shortcut for more information.

If the shortcut character is set to #f, then menu item has no keyboard shortcut.

( send a-selectable-menu-item set-shortcut-prefix prefix)
→ void?
prefix : ( listof ( one-of/c 'alt 'cmd 'meta 'ctl 'shift 'option))

Sets a list of symbols to indicates the keyboard prefix used for the menu item’s keyboard shortcut.

See get-shortcut-prefix for more information.
top ← prev up next →