OSX application menu
John Kiltinen
kiltinen at nmu.edu
Fri Jan 10 10:16:01 EST 2003
This is in response to Shari's question quoted below. Since I read the
list in digest form, and thus with some delay, perhaps this question will
have already been addressed, but here goes anyway.
Shari, you and I have been dealing with OS X problems at about the same
time as we make the transition to this new environment. I was working on
this problem a few weeks ago, and got it solved, with the offlist help of
Jacqueline Landman Gay, who has been a consultant on my project.
I found that the script that you give here (which I got off of this list in
a helpful post from Mark Luetzelschwab) WILL catch the appleEvent messages
if it is a frontScript. To get it as a frontScript, put it as a script in
some object, such as a hidden button "frontScriptDummy". Then in the
message box, enter the command
insert the script of button "frontScriptDummy" into front
This has worked for me, even while my project was under development, but
Jacqueline says that it is not necessary for this script to be in front
once you build a standalone. She wrote (a bit edited here for generality):
>Once your main stack is built into an application, all messages go
>through it just like they go through the Home stack in development mode.
>(snip) During
>development, of course, your main stack is not an application and so the
>message path goes through MetaCard's Home stack instead. You could add a
>line of script if you want, just for development, that tests to see if
>the environment is "development" and if so, start using the script of
>the main stack. Once the stack is compiled into an app, the stack script
>will be put into use automatically.
John Kiltinen
Shari wrote:
>Now that I have OSX installed :-)
>
>I've got everything working as desired except for one thing...
>
>I can't seem to trap the "quit" message.
>
>I have a doQuit handler to save data and so forth before quitting.
>But once OSX moved my Quit menuItem to the application menu, nothing
>I've coded will catch it.
>
>It bypasses the menuPick handlers.
>
>I've tried putting the following appleEvent handler into the card,
>and the stack, to no avail. It bypasses this as well, and just quits.
>
>on appleEvent sClass,sID,sSender
>if sID = "quit" then
> doQuit
> pass appleEvent
>end if
>end appleEvent
>
>I tried sticking a "beep" in there or "answer xyz" to test whether it
>even traps the message. It doesn't.
>
>How do I trap that message, and perform my doQuit operation?
>
>Thanks all.
>
>Shari C
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
John Kiltinen (kiltinen at nmu.edu) Home Office
Professor, Dept. of Math. & CS Tel.(906) 228-8035 or (906) 227-1600
Northern Michigan University Fax (906) 228-4667 or (906) 2272010
Marquette, MI 49855 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
More information about the metacard
mailing list