Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings between nib files (again)



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Bindings between nib files (again) (From: Dave Fernandes <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.