version 2003
PA_PostMacEvent (pNum; theEvent)
Parameter | Type | Description | |
pNum | long | Destination process of the event | |
theEvent | PA_Event | Event sent to ptocess number pNum |
Description
The routine PA_PostMacEvent allows the 4D Plug-in to post an event to the event queue of a particular 4th Dimension process.
Before the call, the plug-in must assign the different fields of the event. A PA_Event is defined in PublicTypes.h as:
typedef struct PA_Event { short fWhat; long fMessage; long fWhen; short fWhereV; short fWhereH; short fModifiers; } PA_Event;
This works like the 4D command POST EVENT. Please, refer to the 4D Language reference for more information. The 4D constant values for what message can be used.
One difference in POST EVENT command is that if the plug-in sets pNum to -2, the event is sent to the Design Process, if it is opened.
Note for MacOS developers
A PA_Event is just like a standard EventRecord (the field when of the EventRecord has just been wrapped in two short fields), and can be use the same way.
Example
Send a mouse down event (left button under Windows) to front most process, at {0, 0} coordinates
long frontProcess; PA_Event event = {0, 0, 0, 0, 0, 0}; // set all fields to 0 // get the front most process number frontPcess = PA_GetFrontWindowProcess(0); //Set the appropriate fields of the event event.fWhat = 1; // 1 means "Mouse down event" event.fWhen = GetTheTickCount();// private routine returning the ticks on both Mac and Windows // post the event PA_PostEvent(frontProcess, event);
See Also
Error Handling
PA_GetLastError always returns eER_NoErr