Cancel a repeat with a button

Jim Bufalini jim at visitrieve.com
Thu May 14 00:23:31 EDT 2009


Guys, look at Jan's example. Setting a "global" is in essence exactly what
she is suggesting. She's just not using a "global" var, per say, but a
custom property called *uInterrupted* which in this case is the same thing
(maybe not obvious unless you know that starting a var name with "u" is a
naming convention for "user" custom property - starting with "c" means the
name of a custom property set. So cMyCustomPropertySet["uMyPropertry"] or,
using an existing default set just uMyProperty). She could have used a
global as in gInterrupted, but this would have to be declared. A custom
property is created on-the-fly and requires no declaration.

In answer to the question of will the key press be recognized during a tight
loop? The answer is yes because notice she also has *wait 0 milliseconds
with messages* which as she already pointed out turns processing over to the
engine for things like key presses and mouse moves during tight repeat
loops. This means it keeps your GUI responsive. Otherwise, a tight repeat
loop would be blocking. So AFAIK, her answer is the best answer. ;-)

Aloha from Hawaii

Jim Bufalini

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] On Behalf Of Stephen Cox
> Sent: Wednesday, May 13, 2009 5:32 PM
> To: How to use Revolution
> Subject: Re: Cancel a repeat with a button
> 
> Why not? You checking a global variable. He said it would take a while
> to
> complete. And I'm assuming he's running the loop in the background.
> 
> User presses cancel button, setting the global variable to True
> 
> In the loop, last statement checks the variable (it's global so the
> code
> will see it).  If True, exit (or whatever cleanup he has, then exit).
> 
> 
> On 5/13/09 11:08 PM, "Colin Holgate" <coiin at rcn.com> wrote:
> 
> >
> > On May 13, 2009, at 11:00 PM, Stephen Cox wrote:
> >
> >> Why not just set a global variable and check it in the loop? Have
> >> the cancel
> >> button set the variable to True when pressed.
> >
> >
> > You would be in a tight repeat loop at the time, so would mouseups on
> > other objects even work?
> >
> >
> > _______________________________________________
> > 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
> 
> --
> Stephen Cox
> Chief geek | Networkx | networkxfla.com
> 
> _______________________________________________
> 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