• 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
Re: Updating menubars, what exactly does setMainMenu do?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating menubars, what exactly does setMainMenu do?


  • Subject: Re: Updating menubars, what exactly does setMainMenu do?
  • From: David Elliott <email@hidden>
  • Date: Fri, 22 Aug 2003 12:22:55 -0400

On Thursday, August 21, 2003, at 11:03 AM, Fritz Anderson wrote:

This probably doesn't work because Cocoa has been repurposed to support the Aqua user interface, in which there is a single, stable menu bar. Swapping the whole menu bar in and out as windows appear or are selected isn't supposed to happen in a Macintosh program, and Apple probably hasn't maintained the vestigial functionality to make it happen.

If you want to hack that behavior into a Cocoa application, I suppose you could do it through setMainMenu: at NSWindow's BecomeKey and ResignKey notifications. You have to handle ResignKey in order to fall back to a useful menu bar when no window is visible.


I found out yesterday that the REAL reason the menu was showing up at the top of the screen was because my own code set the NSApplication menu. I had forgotten about that code and thought it was something Cocoa was doing.

Okay. So yes, the obvious solution is to handle the menu in becomekey and resignkey. That is what wxMac does. Well, actually, wxMac only sets it in become key which gives some rather odd effects as you have noted. I've tried hacking it to be a little more sane but looking at or writing Carbon code makes me want to puke.

You know what they say... necessity is the mother of invention. Hence, wxCocoa was born. :-)

I've got some more questions with regards to the application menu (or the "Apple" menu as I believe the API refers to it) as well as the window menu. I'll post in another thread later.

-Dave
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Updating menubars, what exactly does setMainMenu do? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Unicode and NSTextView
  • Next by Date: Re: Composing a darker image
  • Previous by thread: Re: Updating menubars, what exactly does setMainMenu do?
  • Next by thread: ANN: GNUMail and Pantomime 1.1.0 are released
  • Index(es):
    • Date
    • Thread