Re: Bindings between nib files (again)
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