• 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: Programmatically setting Principle Class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically setting Principle Class


  • Subject: Re: Programmatically setting Principle Class
  • From: Shamyl Zakariya <email@hidden>
  • Date: Fri, 4 Aug 2006 10:54:17 -0400

But the problem here is that I want this to be usable from command- line C++ apps -- like GLUT does. I can't set the principle class in an info.plist when the app's not a .app bundle.

Also, the documentation basically says "Don't override [NSApplication sharedApplication]"...

email@hidden
"Such a theory has to be bizarre and elaborate, as well as being stupid"
-- Jim Loy, regarding a hollow earth



On Aug 3, 2006, at 6:08 PM, Nick Zitzmann wrote:


On Aug 3, 2006, at 3:36 PM, Shamyl Zakariya wrote:

The trouble is, to corral events I override NSApplication and use my own sendEvent: method. If I can, I'd like to be able to programmatically tell Cocoa to use *my* NSApplication subclass, much like setting PrincipleClass in Info.plist does.

Is there a way to do this?

Maybe, by swizzling +[NSApplication sharedApplication] to return an instance of your subclass instead before NSApplicationMain() is called, but that's a bit of a hack and it may break things. It's much easier just to set the NSPrincipalClass in each affected application.


Nick Zitzmann
<http://www.chronosnet.com/>



_______________________________________________ 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: Programmatically setting Principle Class
      • From: Nick Zitzmann <email@hidden>
References: 
 >Programmatically setting Principle Class (From: Shamyl Zakariya <email@hidden>)
 >Re: Programmatically setting Principle Class (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Unlocalises displayName for NSFont?
  • Next by Date: [ANN] JigSaw 2.5b2 released
  • Previous by thread: Re: Programmatically setting Principle Class
  • Next by thread: Re: Programmatically setting Principle Class
  • Index(es):
    • Date
    • Thread