SHIFTy thoughts

Scott Rossi scott at tactilemedia.com
Mon Oct 11 13:26:15 EDT 2010


Here's one way to do what you ask:

[in the card script]

on openCard
   if "trackKeys" is not in pendingMessages() then trackKeys
end openCard

on trackKeys
   set the shiftKeyPressed of me to (65505 is among the lines of keysDown())
   send "trackKeys" to me in 50 millisecs
end trackKeys

This script sets a custom property (shiftKeyPressed) of the card that you
can check.  You could save the state in a global variable if that's more
convenient.  You also might want to limit key tracking to occur only during
certain events/states of your app so you're not needlessly polling key
states.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design




Recently, Richmond wrote:

>   On 10/11/2010 02:06 PM, Colin Holgate wrote:
>> This might give you an idea:
>> 
>> on checkkeys
>>     send checkkeys to me in 100 milliseconds
>>     put shiftkey()
>> end checkkeys
>> 
>> 
>> 
>> _
> 
> This:
> 
> on rawKeyDown
>     if shiftkey() is down then
>        put "DOWN" into fld "fSHIFT"
>     end if
> end rawKeyDown
> 
> on rawKeyUp
>     if shiftkey() is up then
>        put "UP" into fld "fSHIFT"
>        end if
> end rawKeyUp
> 
> in the card script
> 
> works on Linux, but NOT on Mac because pressing the SHIFT key
> does not send a rawKeyDown on a Mac . . .
> 
> One can trap for rawKeyDown for a "normal" key and then if that key is down
> do something like this:
> 
> if the shiftKey is down then
>    do blah, blah, blah
> end if
> 
> what I cannot work out how to do is find out if the SHIFT key is down
> without
> having to plonk my fat fingers on some other key as well.
> _______________________________________________
> 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