arrowKey

Mike Bonner bonnmike at gmail.com
Mon Dec 19 11:28:47 EST 2011


I'm sure this doesn't cover every possibility but will something like the
following work?

-- in the card I put
on arrowKey pKey
   set the cKeyDown of this stack to pKey
   pass arrowKey
end arrowKey

on rawKeyUp pKey
   if pKey is among the items of "65361,65362,65363,65364" then
      if the cKeyDown of this stack is not empty then set the cKeyDown of
this stack to empty
   end if
   pass rawKeyUp
end rawKeyUp


--And in a button I put
local tRunning
on mouseUp
   if tRunning is empty then put false into tRunning
   put not tRunning into tRunning
   checkarrow
end mouseUp

command checkArrow
   if tRunning then
      switch (the cKeyDown of this stack is empty)
         case false
            put the cKeyDown of this stack
            break
         case true
            put "No Key is down"
            break
      end switch
      send checkArrow to me in 10 milliseconds
   end if
end checkArrow

Depending on your needs this might be enough. It doesn't handle 2 arrow
keys being pressed (shouldn't be too bad to modify it so that you can
handle multiple arrow presses, instead of just checking against ALL arrow
keycodes could have a property for each direction keycode and only wipe out
the specific arrow key that is released)

To test, set up the stack as described, click the button to start the
monitoring and then hit your keys. Should show results in the msg box.

On Mon, Dec 19, 2011 at 7:51 AM, paolo mazza <mazzapaoloitaly at gmail.com>wrote:

> Hi All,
> how can I check if the "arrowKey up" is down or is up ?
>
> For example, for the option Key I can write .. if the optioKey is down
> then...,  for the mouse I can write ... if the mouse is down then ...
>
> What about  the arrow keys ?
>
> All the best
>
> Paolo
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list