• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[NSapp mainMenu] returns nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSapp mainMenu] returns nil


  • Subject: [NSapp mainMenu] returns nil
  • From: Christian Stieber <email@hidden>
  • Date: Thu, 30 Mar 2006 16:05:38 +0200

Hi,

I've worked around most of my Cocoa problems by now, but I'm
completely stuck with this one. My application has an empty
application menu --- the title in the menu bar is there,
but no menu below it. Contrary to the NSApplication docs,
mainMenu returns nil. If I just create a new menu and
setMainMenu it, I get the new menu as expected, but again
there is an empty Application menu in front of it.

I'm even playing stupid games now --- the customer has
complained about Apple-Q not working, so I added a menu
with a quit entry and the Q shortcut... but that's not
really what I want :-)

I've been doing the usual random-docs-browsing with all
sorts of related, maybe-related, maybe-possibly-related
and could-be-related keywords, hopping through NSApplication
docs, NSMenu docs, Carbon docs, trying to use Carbon to
create a menu and have Cocoa take it over (yeah...
desperation), trying to search for Window Server docs etc,
in the hope of finding some hint what I have to do to get
either a proper or no Application menu (I would prefer the
correct one, but I can always make a menu and stick some
items in it).

So, I'm still looking for hints. Am I missing something
that I need to do on application startup? I need to play
around with uids a bit --- on startup, I check whether
I have root, fork() a helper process if I do, then drop
root privileges, THEN I call +sharedApplication. It
doesn't make a difference, though --- I tried calling
+sharedApplication first thing in the program, so it
even got fork()ed and everything, I tried calling it
after the fork() but before giving up root --- no´
difference at all. I also double-triple-quadruple-
checked to ensure that I'm still on the process that
was launched from Finder (instead of accidentally
mixing up "child" and "parent" processes).

Alternatively, if I *wanted* to have an empty App
menu, what would I have to do? Maybe I can backtrack
from there to find out what to do to get the menu...

I've always suspected that I'm missing something, since
when I run the app from gdb it doesn't properly register
with the GUI subsystem: I can click buttons and stuff,
but activating a text entry field and typing will *always*
send the keys to the Finder, even though the text entry
field displays the keyboard focus and cursor. This is an
ancient issue with my Mac software; it's been there with
Carbon apps as well, and I never figured out the reason
for it, or even whether it's intentional or just a MacOS
bug.
Drag and drop doesn't work from inside gdb either (it gets
the callbacks, but with a nil pasteboard) --- but both of
these work fine when run from Finder.
However, no Application menu, even when run from Finder.
I can live without proper gdb operation, but it should
work from Finder :-)

Hints, of any sort, any kind, whatever?

Thanks in advance,
  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


  • Follow-Ups:
    • Re: [NSapp mainMenu] returns nil
      • From: j o a r <email@hidden>
    • Re: [NSapp mainMenu] returns nil
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Pop up window ala msn messenger
  • Next by Date: NSFileManager Preference Pane
  • Previous by thread: Re: Handling menu actions in doc-based apps
  • Next by thread: Re: [NSapp mainMenu] returns nil
  • Index(es):
    • Date
    • Thread