like pass, but without ending the handler
J. Landman Gay
jacque at hyperactivesw.com
Wed Feb 28 18:27:51 EST 2007
Chipp Walters wrote:
> Hey Mark,
>
> I'm actually interfacing with a Python scripting tool already embedded
> in a 3-D application. Plus it's on WinXP as well.
>
> Your wait with messages is probably the ticket. I had thought of
> something similar but discarded as I just don't know if it's
> 'blocking' when it's being called from within a different handler.
> IOW, the original handler must stay in a suspended state until the
> library returns a value and thus 'locks up' the interface. I really
> don't know, guess I need to do some mock-ups. I also need to work out
> the fail-safe and error correction stuff.
>
> I suppose I'll also need "stop it now" button which will exit the
> loop, assuming the interface isn't 'Locked Up.' The button would write
> a file which the library is looking for.
I was going to suggest something similar, since I had to do it once.
It's a last-resort kind of thing though, because it can really crank up
the CPU and is in the same precautionary category as polling the mouse.
But sometimes there's no other way.
The repeat loop will block the calling handler, which is what you want.
The important part is the "wait <time> with messages", which allows user
input to occur simultaneously. That will allow you to put in a "stop"
button. But while "wait with messages" does allow the messages to
happen, it does not allow them to be acted on. They will pile up in a
queue until the loop is exited. Some of them, anyway. I think some were
just lost.
What I did was check for a mouseclick inside the repeat loop and if it
occured, do a "click at the clickloc" and then exit the loop:
repeat until <condition: time, file exists, etc.>
if there is a file <whatever> then
-- do stuff
exit repeat -- or return results here
if the mouseclick then
click at the clickloc
exit repeat
end if
end repeat
It's ugly and tempermental but it can be forced to work. I wouldn't ever
use this as a first choice solution though.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list