[BUG] or expected behaviour - rawKeyUp (or Down)

Michael Kann mikekann at yahoo.com
Sun Jan 31 10:11:36 EST 2010


Kay, 

Good find. On Windows XP behavior is you describe it. All non ASCII keys get 65280 added to their number.

Thanks, 
Mike 

--- On Sun, 1/31/10, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

> From: Kay C Lan <lan.kc.macmail at gmail.com>
> Subject: [BUG] or expected behaviour - rawKeyUp (or Down)
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Date: Sunday, January 31, 2010, 7:03 AM
> Whilst trying to track rawKeyUp
> messages I was having great success as
> everything was straight ASCII, until I started to deal with
> DELETE, TAB, and
> RETURN  keys.
> 
> Create a new stack and place this script into the Stack
> Script:
> (this is a 3 line script, watch line wraps)
> 
> on rawKeyUp tKeyCode
>     put numToChar(tKeyCode) & " is
> charToNum:" && tKeyCode & \
>         cr & numToChar (tKeyCode)
> & "is keyCode:" && tKeyCode & \
>         cr & "TAB is charToNum:"
> && charToNum(tab) & \
>         cr & "CR is charToNum:"
> && charToNum(cr.) into msg
> end rawKeyUp
> 
> If you start tapping keys you will see that tKeyCode is
> simply the ASCII
> code equivalent. Great, this makes checking which key was
> pressed very easy.
> There is no effect if modifier keys are pressed, i.e.
> option + 8 does not do
> the • (bullet) but produces 8 and it's ASCII 56. This
> lack of effect of
> modifier keys is explained in the Rev Dictionary, so no
> problem there.
> 
> But when we get to DELETE, TAB and RETURN keys, things
> change, instead of
> producing 8,9 and 10* we get 65288, 65289 and 65293* (on OS
> X) - Basically
> 65280 + the ASCII number*
> 
> This appears to be some kind of Unicode, except the Rev
> Dictionary says
> useUnicode is a Local property which is normally False, so
> in this script,
> as it was not set, it should be False.
> 
> So my first question is, does this appear to be correct
> behaviour as I don't
> understand why the tKeyCode for DELETE, TAB and RETURN*
> does not just report
> as 8, 9 and 10*?
> 
> *What constitutes RETURN in Rev is fully explained in the
> dictionary.
> Although Unix use LF = ASCII 10, and Mac uses CR = ASCII
> 13, and Windows
> uses CR+LF, 13 10; Rev in ALL cases uses LF = ASCII 10 as
> it's end of line
> character.
> 
> So for rawKeyUp (and rawKeyDown) on Mac it appears to
> produce a tKeyCode of
> 65280 + 13 i.e. the ASCII for Mac CR, not Rev RETURN = LF
> (ASCII 10).
> 
> That then raises the next question. I'm hoping that the raw
> keycode for
> DELETE and TAB on Unix/Linux, Mac and Win are all the same
> - 65288. 65289.
> But I get the feeling that the keycode for RETURN (Enter)
> may be 65290 on
> Unix/Linux, it is 65293 on my MBP, and absolutely no clue
> for Win.
> 
> Lastly, is there any chance that these codes may change if
> you are using an
> Extended Keyboard or different keyboard layouts - i.e.
> MacBooks have
> different layouts to MacBook Pros, which have separate
> Enter keys that have
> a keyCode of 65421.
> 
> I'm on SnoLeo with a MBP.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


      



More information about the use-livecode mailing list