Sent when the user presses any key.
# Metadata
Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:
# Syntax
rawKeyDown pKeyCode
# Params
- pKeyCode : The raw keycode of the pressed key.
# Examples
on rawKeyDown theKeyNumber if theKeyNumber is 65308 then increaseScroll -- mouse wheel down else if theKeyNumber is 65309 then decreaseScroll -- mouse wheel up else pass rawKeyDown -- don't forget this! end rawKeyDown
# Description
Handle the rawKeyDown message if you want to intercept raw events from the keyboard, or from a mouse wheel, or if you want to handle keys that aren't mapped to any character.
If the rawKeyDown handler does not pass the message or send it to a further object in the message path, the keypress has no effect. pass the message allows the keypress to have its normal effect.
A rawKeyDown message is also sent when the user moves the mouse wheel on a scrolling mouse; in this case, the message is sent to the control under the mouse pointer.
If the insertion point is in a field, the entry of typed characters is triggered by the rawKeyDown message. This means that trap the rawKeyDown message and not pass it prevents typing from being entered in the field.
>*Cross-platform note:* On Mac OS, no message is > sent when a modifier key (Shift, Option, Control, or Command) is > pressed, unless another key is pressed along with the modifier key. > Mouse wheels do not send a rawKeyDown message on > Mac OS.
# Tags
ui,
# See
- **keyword:** character - **message:** optionKeyDown - **function:** keysDown - **glossary:** object, pass, control, focus, active control, event, mouse pointer, field, message path, trap, Mac OS, current card, message, modifier key, handler - **control structure:** pass