rawKeyDown

Typemessage
DictionaryLCS
LibraryLiveCode Script
Syntax
rawKeyDown <pKeyCode>
Associationsfield
Summary

Sent when the user presses any key.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
pKeyCode

The raw keycode of the pressed key.

Example
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
Values
NameTypeDescription
The result

If the rawKeyDown message is sent as the result of a keypress, the message is sent to the active control, or to the current card if no control is focused.

RelatedKeyword: 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
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. Passing 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 trapping the rawKeyDown message and not Passing it prevents typing from being entered in the field.

*Cross-platform note:* On Mac OS systems, 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 systems.

Tagsui