• 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's run method and menus...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSApp's run method and menus...


  • Subject: NSApp's run method and menus...
  • From: "Jeff Bland" <email@hidden>
  • Date: Sun, 15 Jul 2007 21:05:17 +0900

Is there anything that [NSApp run] does to initialize menus? In a program,
I'm generating menu's like so:

NSMenu *file = [[NSMenu alloc] initWithTitle: @"File"];
[menu setSubmenu: file forItem: [menu itemWithTitle: @"File"]];

and using [NSApp setMainMenu: menu] to make it the application menu.

If I don't call [NSApp run] the menu's do not show up other than the apple
menu and the menu with the application name. If I do call [NSApp run], they
work perfectly. My application employs it's own event loop because it needs
to retain program control (ie it doesn't wait for user input or some event
to do something - it needs to do constant processing).

Of course I could call [NSApp run], and make a custom event that breaks out
of the loop then put my event loop to work, but that feels like a bit of a
hack just to display some menus - everything else runs fine without ever
calling [NSApp run].

Thanks,

- Jeff Bland
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSApp's run method and menus...
      • From: John Stiles <email@hidden>
    • Re: NSApp's run method and menus...
      • From: Shawn Erickson <email@hidden>
    • Re: NSApp's run method and menus...
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Getting modifierFlags during menu action
  • Next by Date: Preference application
  • Previous by thread: Re: Getting modifierFlags during menu action
  • Next by thread: Re: NSApp's run method and menus...
  • Index(es):
    • Date
    • Thread