• 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: Bindings between nib files (again)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings between nib files (again)


  • Subject: Re: Bindings between nib files (again)
  • From: "stephen joseph butler" <email@hidden>
  • Date: Thu, 30 Nov 2006 23:21:49 -0600

2006/11/30, Dave Fernandes <email@hidden>:
I have the simple and very standard task of getting the main menu
items to act on a document object in a multiple document app.
However, the menu and document are in different nib files.

How do you have your document nib setup? Is the File Owner a custom subclass of NSWindowControler?

When I had to do something similar recently, I setup my controller as
a subclass of NSWindowController. Then I set this class as the File
Owner of the nib. Menu items were then connected to a sperate,
different controller instance in MainMenu.

When a menu action was fired, I went through these steps:

1) Get the main window from NSApp:

wndw = [NSApp mainWindow];

2) Get the controller from the window:

cntrlr = [wndw windowController].

3) Check the controller class and cast/call the appropriate function:

[cntrlr isKindOf:[MyWindowController class]]


Not sure this is the most cocoa way of doing things, but it worked for me. _______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Bindings between nib files (again) (From: Dave Fernandes <email@hidden>)

  • Prev by Date: Re: Bindings between nib files (again)
  • Next by Date: Re: Bindings between nib files (again)
  • Previous by thread: Bindings between nib files (again)
  • Next by thread: Re: Bindings between nib files (again)
  • Index(es):
    • Date
    • Thread