• 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: Programatically creating NSMenu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programatically creating NSMenu?


  • Subject: Re: Programatically creating NSMenu?
  • From: Jeff Johnson <email@hidden>
  • Date: Wed, 8 Apr 2009 13:37:10 -0500

It does seem to require an .app bundle, yes.

I can successfully run it from Terminal rather than Finder, though, as long as the executable is in a bundle.

-Jeff


On Apr 8, 2009, at 12:46 PM, DairyKnight wrote:

If you build the project with XCode, it would automatically create the bundle structure for you and it would work.

Without the bundle directory, the main menu won't show correctly (e.g. cp your executable to ~/).
The solution seems to be creating a bundle directory structure and run from Finder - even if there's just the executable, without any info.plist or pkginfo.


Regards,
Daqi


On Apr 9, 2009, at 1:40 AM, Jeff Johnson wrote:

Hi Daqi.

Could you post your code or project? I haven't noticed any problems myself.

Please note that the latest (Leopard-only) solution is here:

http://lapcatsoftware.com/blog/2008/10/20/working-without-a-nib-part-7-the-empire-strikes-back/

-Jeff


On Apr 8, 2009, at 8:13 AM, Daqi Pei wrote:

I've been trying to create a Cocoa GUI application without IB. Everything
works fine except for the NSMenu.
After digging over the internet I found a solution from '
http://lapcatsoftware.com/blog/2007/06', by using some undocumented methods
and member variables.


I succeeded in creating the application, and what I found interesting is, it
seems that if I run the application from Terminal, no menu
would be shown (the Windows still work fine). The only way to have the menus
working properly is to create an Application.app directory structure, and
run from Finder. Apps with static Nibs work fine both running from Terminal
and Finder.


Again I'm doing this only to understand how the system works. Did I miss
something or it's just the way the framework was designed?




Regards,
Daqi Pei

_______________________________________________

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


References: 
 >Programatically creating NSMenu? (From: Daqi Pei <email@hidden>)
 >Re: Programatically creating NSMenu? (From: Jeff Johnson <email@hidden>)
 >Re: Programatically creating NSMenu? (From: DairyKnight <email@hidden>)

  • Prev by Date: Re: noob: Question about senders and views
  • Next by Date: Re: finder file size
  • Previous by thread: Re: Programatically creating NSMenu?
  • Next by thread: Re: Programatically creating NSMenu?
  • Index(es):
    • Date
    • Thread