key-event% : class? |
superclass: event% |
For a key-press event, a virtual key code is provided by get-key-code. For a key-release event, get-key-code reports 'release, and a virtual key code is provided by get-key-release-code.
See also Mouse and Keyboard Events.
| ||||||||||||||||||||||||||||||||||||
→ (is-a?/c key-event%) | ||||||||||||||||||||||||||||||||||||
key-code : (or/c char? symbol?) = #\nul | ||||||||||||||||||||||||||||||||||||
shift-down : any/c = #f | ||||||||||||||||||||||||||||||||||||
control-down : any/c = #f | ||||||||||||||||||||||||||||||||||||
meta-down : any/c = #f | ||||||||||||||||||||||||||||||||||||
alt-down : any/c = #f | ||||||||||||||||||||||||||||||||||||
x : (and/c exact? integer?) = 0 | ||||||||||||||||||||||||||||||||||||
y : (and/c exact? integer?) = 0 | ||||||||||||||||||||||||||||||||||||
time-stamp : (and/c exact? integer?) = 0 | ||||||||||||||||||||||||||||||||||||
caps-down : any/c = #f |
The release key code, as returned by get-key-release-code, is initialized to 'press.
(send a-key-event get-alt-down) → boolean? |
(send a-key-event get-caps-down) → boolean? |
(send a-key-event get-control-down) → boolean? |
Under Mac OS X, if a control-key press is combined with a mouse button click, the event is reported as a right-button click and get-control-down for the event reports #f.
(send a-key-event get-key-code) → (or/c char? symbol?) |
The special key symbols attempt to capture useful keys that have no standard ASCII representation. A few keys have standard representations that are not obvious:
#\space – the space bar
#\return – the Enter or Return key (on all platforms), but not necessarily the Enter key near the numpad (which is reported as 'numpad-enter if the platform distinguishes the two Enter keys)
#\tab – the tab key
#\backspace – the backspace key
#\rubout – the delete key
If a suitable special key symbol or ASCII representation is not available, #\nul (the NUL character) is reported.
Under X, a 'wheel-up or 'wheel-down event may be sent to a window other than the one with the keyboard focus, because X generates wheel events based on the location of the mouse pointer.
Under Windows, when the Control key is pressed without Alt, the key code for ASCII characters is downcased, roughly cancelling the effect of the Shift key. Under Mac OS X, the key code is computed without Caps Lock effects when the Control or Command key is pressed; in the case of Control, Caps Lock is used normally if special handling is disabled for the Control key via special-control-key. Under X, the key code is computed with Caps Lock effects when the Control key is pressed without Alt.
See also get-other-shift-key-code.
(send a-key-event get-key-release-code) → (or/c char? symbol?) |
(send a-key-event get-meta-down) → boolean? |
The get-other-altgr-key-code method provides the same information with respect to the AltGr key (i.e., Alt combined with Control) under Windows and X, or the Option key under Mac OS X. The get-other-shift-altgr-key-code method reports a mapping for in tha case that both Shift and AltGr/Option were different from the actual event.
The get-other-shift-key-code, get-other-altgr-key-code, and get-other-shift-altgr-key-code results all report key mappings where Caps Lock is off, independent of whether Caps Lock was on for the actual event. The get-other-caps-key-code method reports a mapping for in that case that the Caps Lock state was treated opposite as for the get-key-code result. (Caps Lock normally has either no effect or the same effect as Shift, so further combinations involving Caps Lock and other modifier keys would not normally produce further alternatives.)
Alternate mappings are not available for all events. Under Windows, alternate mappings are reported when they produce ASCII letters, ASCII digits, and ASCII symbols. Under Mac OS X, alternate mappings are available only when the Command key is pressed. Under X, alternate mappings are usually available.
(send a-key-event get-shift-down) → boolean? |
(send a-key-event set-alt-down down?) → void? |
down? : any/c |
(send a-key-event set-caps-down down?) → void? |
down? : any/c |
(send a-key-event set-control-down down?) → void? |
down? : any/c |
Under Mac OS X, if a control-key press is combined with a mouse button click, the event is reported as a right-button click and get-control-down for the event reports #f.
(send a-key-event set-meta-down down?) → void? |
down? : any/c |
(send a-key-event set-shift-down down?) → void? |
down? : any/c |