(mac) application menu

Peter Brigham pmbrig at gmail.com
Tue Nov 13 21:35:29 EST 2007


OK, so there's obviously something(s) I don't get about what happens  
with the "quit" menu item in the application menu when I make a  
standalone. The bottom item in the "file" menu is treated as a quit  
command and is moved on the mac to the bottom of the application  
menu, and appears as "quit <myApp>". This much is clear. Two  
mysteries for me (I'm developing on a Mac):

Problem 1. Recipe: make a new stack. Use the menubuilder to make the  
minimal menubar ("uMenubar" -- file, edit, help), and use the  
autoscript builder to make the basic menupick scripts for each  
button. Put "answer" commands in each menupick switch case to show  
which menuitem you have selected, eg,
...
case "open"
   answer "you're trying to open something" as sheet
   break
case "quit"
   answer "you're trying to quit" as sheet
   break
end switch

Run it in the IDE -- fine, everything prompts the expected answer  
dialogs, and you can't quit from the File->Quit menuitem, since the  
switch statement intercepts it with a bare answer command. Now make  
the stack into a standalone, setting the menubar of the stack to  
"uMenubar" -- everything works as expected except that selecting  
"quit <myApp>" from the application menu results in a peremptory quit  
-- no answer dialog saying "you're trying to quit". So I thought  
maybe the message is actually not just "quit" but "quit <myApp>" so I  
changed the switch & case statements to read "case pWhich contains  
"quit" -- but still no dialog, just a peremptory quit. Obviously the  
system is catching the message and the rev engine in the app never  
sees it. Same with the command-Q keyboard shortcut -- the  
commandkeydown handler in the main stack script never sees it, though  
it intercepts all the other keyboard menu equivalents.

All of the above occurs in a simple test stack as prescribed above.  
What is even stranger is that in the only slightly more complex stack  
I have been trying to turn into an app (for collecting, sharing, and  
printing recipes), I have the *opposite* problem -- when I turn it  
into a standalone, selecting the "quit" item from the application  
menu does **nothing at all**. Nada. Neither does the command-q  
shortcut (which I scripted for), except the application menu hilites  
briefly. The only way I can quit the app is to click the close box.  
Which is fine, but the menu choice & the keyboard equivalent should  
work too. Windows folks will expect to quit with the close box, but  
Mac folks will be more likely to use the menu or the keyboard.

How do I catch the quit message when the user selects it from the app  
menu or does a command-q? -- I need to perform some housekeeping and  
save operations, write the data to a file, etc. before the app  
closes: something like saveDataToFile; cleanUpStuff; pass "quit". I  
tried catching the closeStackRequest message but that never gets  
triggered by the "quit" menuitem either, or by cmd-q.

There is something fundamental that I don't understand about the  
myApp>quit menu for a Mac standalone. Can someone explicate this?

Problem 2. When I first created my recipe stack I named things  
somewhat hastily, and I tried once when I was mostly done to create a  
standalone, then went back to revise a bunch of things. As I  
developed it further I renamed the stack file and the main stack,  
which was originally named "recipeFile". I also chose a different  
name in the standalone preferences for the eventual application. When  
I converted it to a standalone finally, it was named properly in the  
Finder (as specified in the standalone preferences), but the  
application name as it appears in the application menu on the mac  
(and in the "quit <myApp>" menuitem) is the original name of the main  
stack, "recipeFile". And nothing I do results in altering this. I  
have changed the name of the main stack, the label of the main stack,  
the name of the application bundle in the standalone preferences, the  
name of the stack file, but the old "recipeFile" stubbornly continues  
to be what appears next to the apple menu in the standalone, and in  
the "quit" item of that menu. There is *nothing* now in the stack  
file that bears the name "recipeFile" -- not the name of the stack in  
the Finder, not the main stack name, not the main stack label,  
nothing. I don't know where the standalone builder is getting the  
string "recipeFile" from at this point. Did it somehow save it from  
when I originally tried to make the first standalone?

If someone can try this to check it for me: create a stack, name it  
something, then turn it into a standalone. Now rename the stack in  
the finder, rename the main stack, change the label on the main  
stack, change the app name in the standalone builder settings, and  
make another standalone. Does the application menu title change? and  
if so, what to? The new main stack name? the new application name as  
specified in the standalone builder settings? I'm not sure if I'm  
more worried that this is a reproducible bug, or that it's some weird  
quirk of my system, but in either case I need to fix it. I'm running  
Studio 2.8.1 build 471 on OSX 10.4.10 on an iBook G4.

I'm getting bald from tearing my hear out. I do *not* want to have to  
make a whole new main stack from scratch just so I can name it  
properly from the beginning!

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig/

--  Oh, no, not another learning experience!



More information about the use-livecode mailing list