Toolbar Item In NSDocument accessing controller in MainMenu.nib
Toolbar Item In NSDocument accessing controller in MainMenu.nib
- Subject: Toolbar Item In NSDocument accessing controller in MainMenu.nib
- From: "Patrick Burleson" <email@hidden>
- Date: Thu, 3 Apr 2008 22:56:13 -0500
I'm getting used to Interface Builder and Cocoa in general and I had a
"best practices" sort of question:
I have an AppController defined in my MainMenu.nib file that, in this
case, is the target of the "Preferences..." menu item. ( I don't know
if target is the right word exactly ).
I've also added a toolbar to my MyDocument.nib with a "Preferences"
toolbar item. To get this toolbar item to call the same method on the
AppController the Menu Item uses, I made the AppController the
delegate of the Application in MainMenu.nib. I created a NSApplication
outlet in MyDocument.h and a method for the Preferences toolbar item
to call. That method is defined as:
- (void)showPreferencePanel:(id)sender {
[[application delegate] showPreferencePanel:sender];
}
to show the preferences pane of my application. This all works, but I
wanted to make sure there wasn't a "better" way of doing it.
I'd really like a way for the Toolbar Item to hit the AppController
directly to reduce the duplicated code.
Any suggestions would be appreciated.
Patrick
_______________________________________________
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