Re: [NSapp mainMenu] returns nil
Re: [NSapp mainMenu] returns nil
- Subject: Re: [NSapp mainMenu] returns nil
- From: Christian Stieber <email@hidden>
- Date: Mon, 03 Apr 2006 14:09:41 +0200
At 18:26 30.03.2006 +0200, you wrote:
[ Thanks for both replies, but since the first one is a aubset
of the second... ]
Do you ever call NSApplicationMain()?
No. I'm still not doing it, but when I looked at the "docs"
for that function, I saw NSApplicationLoad() just above
it, which seemed more appropiate. Currently I'm calling
that just before +sharedApplication --- and what do you
say, I get a main menu :-) Quit from there doesn't work,
but I suspect that's because the Apple-Q shortcut is
still in the other menu or something like that, but I'm
a step ahead already :-) Looks MUCH better now...
Do you have a "MainMenu.nib" file,
No. I don't have any *.nib files.
with a menu in it? Do you have a NSRunLoop configured and
running?
Well, not much configuation done on my side. I added
a number of timers and other stuff (I also suspect that
the IOKit monitoring hooks to the runloop eventually),
and just use [NSApp run] after everything is set up.
So far, that has worked just fine.
If the answer was no to any of these questions, why is that?
*Checks answers*... oh, no MainMenu.nib file. Thing is,
I only did a quick search for the nib format, didn't
find anything, so I'm not using it. Interface builder
can create them, but I can't use that --- it runs on
Macs only, and IB-projects seem to be a nightmare to
localize. I'm used to just pulling the strings out of
our localization database at buildtime, which means I'd
have to write a tool to incorporate them into the nib
files to create the localized GUIs. Certainly possible,
but we are not selling software build systems, so I didn't
do a lot of research into that area.
I wouldn't start trying to access the menu before "-applicationWill/
DidFinishLaunching:" if I could help it. See if it isn't working OK
at that time if you just leave it alone while it's getting set up.
It seems to work now, but I might do that anyway. The documentation
seems rather unspecific as to whether things run async during startup
or not, especially since I never had problems on any box with just
calling +sharedApplication, creating all the windows and stuff, and
finally opening my first window, before dropping into the main
eventloop, But then, I'm setting up quite a few things, which
probably uses more than one timeslot...
In any case, the pointer to NSApplicationMain() looks great :-)
Thanx,
Christian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden