Hi Matthias ;-)
At 10:05 +0100 10/11/05, Matthias Schmidt wrote:
Larry,
thanks a lot, but how do I do the miracle then.
Do I have to install an EventHandler in the Callback procedure?
The thing I'm working is a 4D Plugin (my fist one).
[snip]
You can have a look to (yes, again ;-)[note for other readers:
Matthias and I used to talk on the 4D PluginTalk mailing list]) our
ToolboxPack plugin. It has a routine called
"tp_GetApplicationEvents". This routine installs a callback that
executes a 4D method for some application events (see the demo
database, execute the aGetAppliEvents_Install method, do some stuff
(bring an app to front, bring 4D to front, launc an app, ...), and
look at the log created by the 4D callback.
To do this, I InstallEventHandler for some events. Here is an
abstract of the code.
switch(eventKind)
{
case kEventAppActivated:
case kEventAppDeactivated:
case kEventAppHidden:
case kEventAppShown:
ignoreErr = TrapEvts_ApplicationDoCallback(eventKind, 0);
break;
// case kEventAppLaunchNotification:
case kEventAppLaunched:
case kEventAppTerminated:
case kEventAppFrontSwitched:
{
ProcessSerialNumber psn;
// We're a 4D plugin. Don't know what 4D does with this, and even if it
// has installed an handler. We always return "not handled",
even if an error
// occured, to let 4D handle the stuff if needed.
return eventNotHandledErr;
} /* TrapEvts_EventHandler */
The TrapEvts_ApplicationDoCallback just execute the 4D callback
method. Note that there is a trick with this when you're executed as
a 4D's plug-in: when you're in a "system" callback/handler, you can't
call PA_ExecuteMethod nor can you you execute any 4D code. Well, you
can, but it crashes ;-) because the code is executed in a place where
4D has no context for the 4D code to be executed (say, the current 4D
process number is 0). If you want to execute 4D code, you must use a
sepcial 4D External Process that is freezed/Unfreezed when needed
(PA_UnfreezeProcess works from a system callback/handler, it is not
4D code).
Thibaud Arguillere
Osmose Editeur
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden