• 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: First Responder and menus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First Responder and menus


  • Subject: Re: First Responder and menus
  • From: Matt Neuburg <email@hidden>
  • Date: Tue, 04 Jul 2006 08:35:05 -0700
  • Thread-topic: First Responder and menus

On Tue, 4 Jul 2006 08:52:12 -0400, "Alan Smith" <email@hidden>
said:

>I'm trying to hook a menu item in one nib to an action of a controller
>in another nib. I spent this morning reading about First Responder and
>have thoroughly searched the internet. I found lots of articles but
>they all say the same thing: Add an action in the First Responder in
>the nib with the menu item and add an action to the controller. Well,
>I've done that and the menu item remains grayed out. I then tried
>making my controller a NSWindowController, that didn't help either.

Here's a really great trick for these situations. Simply implement
validateMenuItem: in the same class where you hope to receive the action
message, and add some logging so you know whether it's being called. Now run
your app and attempt to choose your menu item. If validateMenuItem: isn't
called, your instance is not in the responder chain and you need to review
your understanding of the responder chain. m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Re: First Responder and menus
      • From: "Michael Ash" <email@hidden>
  • Prev by Date: Re: NSOpenPanel not respecting file types?
  • Next by Date: Re: NSMutableArray-can't add objects of my class
  • Previous by thread: Re: First Responder and menus
  • Next by thread: Re: Re: First Responder and menus
  • Index(es):
    • Date
    • Thread