• 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: Responder Chain and newDocument:, runPageLayout:, etc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Responder Chain and newDocument:, runPageLayout:, etc


  • Subject: Re: Responder Chain and newDocument:, runPageLayout:, etc
  • From: Dietrich Epp <email@hidden>
  • Date: Tue, 10 Dec 2002 18:11:43 -0800

On Tuesday, December 10, 2002, at 06:18 , Timothy Hatcher wrote:

Mimic the behavior using what? Seems that New works just fine, I don't
see why a mimic is necessary.

I would like other objects in my application to respond to actions from
the main menu. This way I wouldn't have to add all the specific methods
to the application delegate and just let the actual methods from other
objects respond. I know I could instantiate the objects in the NIB and
attach the menu items to them, but I have many controllers that need
menu space. Are there any tricks to do this?

No, not really.

Let's say you have a view subclass, Foo, with a menu item, Bar. Foo has a selector,

- (IBAction)Bar:(id)sender;

Now take the Foo.h file and drag&drop it on your Main.nib open in Interface Builder. That adds the class to the class hierarchy in Main.nib. Connect your menu item "Bar" to "First Responder". Select "Bar:" as its target. Notice that there is not actually an instance of a Foo in Main.nib.

The Foo class should implement "validateMenuItem" or whatever the method name is, or the "Bar" menu item will be dimmed.

The first responder has every action that is implemented by any class. If the responder chain doesn't actually respond to the action, the menu item will be grayed.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Responder Chain and newDocument:, runPageLayout:, etc (From: Timothy Hatcher <email@hidden>)

  • Prev by Date: Re: buttonType in NSButton
  • Next by Date: Re: Setting the image on a pop up button
  • Previous by thread: Re: Responder Chain and newDocument:, runPageLayout:, etc
  • Next by thread: Modifying dyld behavior for framework
  • Index(es):
    • Date
    • Thread