![]() |
AEIdleProcPtr |
||||
Header: | AEInteraction.h | Carbon status: | Supported | |
Defines a pointer to a function the Apple Event Manager calls while your application waits for a reply to an Apple event. Your idle function must handle update, null, operating-system, and activate events.
typedef Boolean(* AEIdleProcPtr) ( EventRecord *theEvent, SInt32 *sleepTime, RgnHandle *mouseRgn );
You would declare your function like this if you were to name it MyAEIdleCallback:
Boolean MyAEIdleCallback ( EventRecord *theEvent, SInt32 *sleepTime, RgnHandle *mouseRgn );
A pointer to the event record of the event to process.
A pointer to a value that specifies the amount of time (in ticks) your application is willing to relinquish the processor if no events are pending.
A pointer to a value that specifies a screen region that determines the conditions under which your application is to receive notice of mouse-moved events.
Your idle routine returns TRUE if your application is no longer willing to wait for a reply from the server or for the user to bring the application to the front. It returns FALSE if your application is still willing to wait.
If your application provides a pointer to an idle function as a parameter to the AESendfunction or the AEInteractWithUser function, the Apple Event Manager will call the idle function to handle any update event, null event, operating-system event, or activate event received for your application while it is waiting for a reply.
To provide a pointer to your idle callback function, you create a universal procedure pointer (UPP) of type AEIdleUPP, using the function NewAEIdleUPP. You can do so with code like the following:
AEIdleUPP MyIdleUPP;
MyIdleUPP = NewAEIdleUPP (&MyIdleCallback);
You can then pass the UPP MyIdleUPP as a parameter to either the AESend function or the AEInteractWithUser function.
If you wish to call your idle callback function directly, you can use the InvokeAEFilterUPP function.
After you are finished with your idle callback function, you can dispose of the UPP with the DisposeAEEventHandlerUPP function. However, if you will use the same idle function in subsequent calls to AESend or AEInteractWithUser, you can reuse the same UPP, rather than dispose of it and later create a new UPP.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)