• 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
Toolbar Item In NSDocument accessing controller in MainMenu.nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: NSCondition easter-egg hunt
  • Next by Date: Re: activate my application while dragging on other application window
  • Previous by thread: Image in NSPopupButtonCell
  • Next by thread: Window's Content Border disappears!
  • Index(es):
    • Date
    • Thread