Main menu items on mac OS X

When I create an application using the template “SDL Application”, no items
are in the main menu of the compiled program. A main menu is created,
with the name of the project, but the normal items (Quit, Hide, Hide others)
are all absent. This also means the normal command-q quit shortcut is
missing as well.

Can someone familiar with cocoa take a look at SDLMain.m? I’m surprised
this has gone unnoticed for so long. Using OS X v. 10.3.5 and SDL 1.2.7

John
---- Introducing Spymac MailPro: http://www.spymac.com/mailpro/

When I create an application using the template “SDL Application”, no
items
are in the main menu of the compiled program. A main menu is created,
with the name of the project, but the normal items (Quit, Hide, Hide
others)
are all absent. This also means the normal command-q quit shortcut is
missing as well.

Can someone familiar with cocoa take a look at SDLMain.m? I’m surprised
this has gone unnoticed for so long. Using OS X v. 10.3.5 and SDL 1.2.7

Actually, it’s not gone unnoticed “for so long at all”. Things used to
work fine, Apple just changed its (internal and undocumented API)
somewhat in 10.3, it seems, and so far nobody found out how to do these
things under 10.3 (esp. in a backward compatible way); though
admittedly probably not too much effort went into it.

But anyway, if you are building your app using XCode / Project Builder
(as you seem to suggest) you can simply use the alternate, .nib based
approach to providing menus in your application; that works very well
under all OS X versions w/o any special tricks or hacks. I am surprised
that the PB based version of SDL doesn’t use that by default anyway. To
use it, look for SDL_USE_NIB_FILE in SDLmain., change it to 1, and
also modify your copy of SDLMain.nib to your liking.

We have two ways to do the main menus and stuff because the one way
(using .nib files) is “official” and should always work; but it has the
drawback of requiring your application to have a .app structure, so
it’s impossible to write command line apps using it. OTOH, the things
we have to do to get stuff working w/o the .nib rely partially on
undocumented behavior of the OS, and hence are vulnerable to breakage
whenever Apple modifies the OS.

Bye,

MaxAm 02.09.2004 um 13:33 schrieb John Philip:

Small correction to myself: I actually had a working patch for
SDLmain.m floating around – I thought my personal attempts had failed
(I played with this half a year ago or so), but apparenly I just forgot
to send it to sam (something I just changed). So hopefully, if my code
works on 10.2, too, it’ll be in SDL CVS soon. Feel free to mail me
privately if you want a copy of the patch now for testing.

Bye,

Max