• 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: Can 2 nib share a same custom class instance?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can 2 nib share a same custom class instance?


  • Subject: Re: Can 2 nib share a same custom class instance?
  • From: Jean-Nicolas Jolivet <email@hidden>
  • Date: Tue, 18 Nov 2008 18:27:18 -0500

Thanks for the reply...

I guess I had what you could call a "brainfreeze" moment...

My CustomWindowController is created programatically from my AppController... therefore, when the App Controller's action is triggered by the menu item, I just call the approriate Custom Controler's action....

I got a bit mixed up because my windows/controllers are set up in a weird way (I'm using a third party class so I had no other options)...

Anyway, I got it working now!

Thanks!

On 18-Nov-08, at 6:22 PM, Kyle Sluder wrote:

On Tue, Nov 18, 2008 at 5:43 PM, Jean-Nicolas Jolivet
<email@hidden> wrote:
I have a custom window controller (let's call it CustomWindowController) to
manage a custom window... this is contained in a separate nib file (i.e. not
in my MainMenu.nib)

Typically this isn't what you want to do. You'll usually create the window controller from code (external to any nib) and use it as the owner of a nib that contains the window you want it to control.

In that window's nib file, the File Owner is set to that
CustomWindowController class so that my class can communicate with my
window...

Good.

Now here comes the tricky part: I want a menu item from the app's main menu
(located in MainMenu.nib) to ALSO be able to perform this action (the same
performActionClicked: thats located in my CustomWindowController)....

Use the responder chain.

Is there a way that both nib files can "share" the same instance of my
CustomWindowController???

If you can reach it from File's Owner, you can do what you want, but as I said above this is a typical use of the responder chain. Though depending on your situation an NSWindowController subclass might not be the appropriate place for it; it might be an NSDocument subclass or your NSApplication's delegate.

--Kyle Sluder

Jean-Nicolas Jolivet email@hidden http://www.silverscripting.com

_______________________________________________

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: 
 >Can 2 nib share a same custom class instance? (From: Jean-Nicolas Jolivet <email@hidden>)
 >Re: Can 2 nib share a same custom class instance? (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: Can 2 nib share a same custom class instance?
  • Next by Date: Re: window flash
  • Previous by thread: Re: Can 2 nib share a same custom class instance?
  • Next by thread: NSNumberFormatter & Currency Symbol
  • Index(es):
    • Date
    • Thread