simulate keystroke

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Oct 27 04:58:42 EDT 2008


Larry,

This has nothing to do with focus. You should change your approach.  
The following makes your script slower, yet much more responsive.

Create a button with a mouseUp handler, which calls a main handler.

on mouseUp
   set the hilite of btn "Switch" to true
   foo fld "Very Long List"
end mouseUp

Put the following in e.g. the card script. This handler calls itself.

on foo theVeryLongList
   if the hilite of btn "Switch" is true then
     -- do something here with line 1 of theVeryLongList
     -- and delete that line. You might use a completely
     -- different approach here if you want.
     delete line 1 of theVeryLongList
     send "foo theVeryLongList" to me in 0 millisecs
   end if
end foo

Add a checkbox named "Switch". This button doesn't need a script.

If you click the first button, the switch will be turned on and the  
foo handler will run. When you click the checkbox, the foo handler  
will stop running.

You can also make a switch without another button. Just make a  
checkbox with the following script.

on mouseUp
   if the hilite of me then foo fld "Very Long List"
end mouseUp

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum/

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 27 okt 2008, at 00:37, Larry Watts wrote:

> hi Mark,
> What I'm really wondering how to do is this:
> I have a button script running with a lot of repeat statements in  
> it. Depending upon the input, the script will run for 5 minutes to  
> an hour.  I want the user to be able to interrupt the script by  
> clicking on another button on the card.  But as I understand it, Rev  
> cannot do that because the first button has the focus until the  
> entire script is finished running. Is there a way to work around  
> this limitation of Rev?
> thanks, Larry




More information about the use-livecode mailing list