Error getting tags :
error 404Error getting tags :
error 404 rawKeyDown | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
rawKeyDown
Basics
Expander triangle
Type
Message
Syntax
rawKeyDown keyCode
Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Sent when the user presses any 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!
Downd rawKeyDown

Additional Comments
Expander triangle

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.

Parameters:

The keyCode is the raw keycode of the pressed key.

Comments:

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.

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

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 rawKeyDownmessage on Mac OS systems.

User Comments
Expander triangle
User thumbnail
(hidden)
StarStarStarStarStar
Mar 23, 2009
Here is a sample handler you can use to implement scroll wheel behavior in fields that do not get scrolled automatically by the engine (I.e. fields that do not have a scrollbar showing:


on rawkeydown pKey
if pKey is 65308 and not the vScrollbar of the target then
scrollUp
else if pKey is 65309 and not the vScrollbar of the target then
scrollDown
else if pKey is 65310 and not the hScrollBar of the target then
scrollLeft
else if pKey is 65311 and not the hScrollBar of the target then
scrollRight
else
pass rawkeydown
end if
end rawkeydown

command scrollUp
local tScrollValue
put round(the formattedheight of the target / 20) into tScrollValue
set the vScroll of the target to (the vScroll of the target + tScrollValue)
end scrollUp

command scrollDown
local tScrollValue
put round(the formattedheight of the target / 20) into tScrollValue
set the vScroll of the target to (the vScroll of target - tScrollValue)
end scrollDown

command scrollLeft
local tScrollValue
put round(the formattedWidth of the target / 20) into tScrollValue
set the hScroll of the target to (the hScroll of the target + tScrollValue)
end scrollLeft

command scrollRight
local tScrollValue
put round(the formattedwidth of the target / 20) into tScrollValue
set the hScroll of the target to (the hScroll of target - tScrollValue)
end scrollRight

User thumbnail
Trevor DeVore
StarStarStarStarStar
Apr 9, 2009
One addition to Kevin's rawkeydown handler. The following should be the first line in the handler:

if word 1 of the target is not "field" then pass rawkeydown


The rest of the code in the handler assumes a field is the target so an error can occur if the target doesn't have a v/hscrollbar property.
User thumbnail
geradamas@yahoo.com
StarStarStarStarStar
Feb 6, 2010
You can download JPEG images of rawKeyDown values for Macintosh from
http://andregarzia.on-rev.com/richmond/STUFF/rawKeys.zip