[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AE Suspend/Resume - Solved

> My question involves the use of the #_AESuspendTheCurrentEvent and
> #_AEResumeTheCurrentEvent toolbox calls within MCL's Apple Event methodology,
> since I will have to suspend an Apple Event while waiting for an update from
> a host connection.  I want to be able to keep the event stored in an object
> until the host connection is ready and then reply.  The source code for these
> things (from the CD) gives me lots of ideas but I'm unable to get it all
> working right.
Okay, I figured it out.  Gee, seems that if you read the documentation and
source code VERY CLOSELY and repeat it to yourself over and over something will
eventually start making more sense.
To pass along the two Major Things I discovered:
1) #_AESuspendTheCurrentEvent must occur inside the handler called by the
operating system, which is most definitely *not* the handlers defined by defun
or defmethod.  This call needs to come from within #defer-appleevent-handler,
which is a defpascal in the source code.
2) Don't try testing this feature by writing both the send and receive Apple
Events inside the same MCL 'cause it won't work.  I finally noticed -- after
staring at #'defer-appleevent-handler for two hours -- that some code in there
forces the event to be handled right away (to keep events from falling all over
each other).
I did finally get it all working to my satisfaction, if anyone wants more gory