Trapping multiple keystrokes

Kaveh Bazargan kaveh at rivervalleytechnologies.com
Fri Dec 1 17:02:55 EST 2017


Hi Paul

It looks like just what I need and thanks for that, but it does not do the
job in my stack and in the single field stack with one line added:


on arrowKey theKey
   put 1 into increment
   put me into current_value
   if theKey is "up" then
      put current_value + increment into the target
      repeat with i = 1 to 1000000
         put 1+i into temp
      end repeat
   end if -- up
   if theKey is "down" then
      put current_value - increment into the target
   end if -- down
   flushEvents("autoKey")
   pass arrowKey
end arrowKey

(note flushEvents near end)

The stack moves from the front so it no longer sees the arrows. This is a
separate problem I have had. (sorry to bring up this second issue.) Cannot
work out how to bring forward the main stack

On 1 December 2017 at 21:45, Paul Dupuis via use-livecode <
use-livecode at lists.runrev.com> wrote:

> On 12/1/2017 1:00 PM, Paul Dupuis via use-livecode wrote:
> > On 12/1/2017 12:52 PM, Kaveh Bazargan via use-livecode wrote:
> >> I have a field with a number in it. when focused, I want the value to
> go up
> >> and down with the up/down arrow keys. The trouble is that if I keep the
> key
> >> down, it traps multiple keydown messages that continue after the key is
> >> released.
> >>
> >> How can I ensure that message are terminated as soon as arrow key is
> >> released?
> >>
> > look at the dictionary entries for 'the pendingMessages' and the
> > 'cancel' command
> >
> >
> > _______________________________________________
> > 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
> >
> what you actually want is flushEvents(eventType) -- see dictionary
>
>
> just execute flushEvents("autoKey") when you handler is done to clear
> extraneous arrowkey messages
>
>
> _______________________________________________
> 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
>



-- 
Kaveh Bazargan
Director
River Valley Technologies <http://rivervalleytechnologies.com/> • Twitter
<https://twitter.com/kaveh1000> • LinkedIn
<https://www.linkedin.com/in/bazargankaveh/>
Phone +44 7771 824 111



More information about the Use-livecode mailing list