FROM : Matt Neuburg
DATE : Wed Jul 05 18:29:14 2006
On Wed, 5 Jul 2006 02:01:12 -0400, "Michael Ash" <michael.<email_removed>>
said:
>On 7/4/06, Matt Neuburg <<email_removed>> wrote:
>> On Tue, 4 Jul 2006 08:52:12 -0400, "Alan Smith" <<email_removed>>
>> 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.
>
>validateMenuItem: won't get called unless the system has already
>determined that your object responds to the action
Sorry about that. My "trick" depended upon some rather specialized
conditions that don't always inhere. m.
--
matt neuburg, phd = <email_removed>, <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>
DATE : Wed Jul 05 18:29:14 2006
On Wed, 5 Jul 2006 02:01:12 -0400, "Michael Ash" <michael.<email_removed>>
said:
>On 7/4/06, Matt Neuburg <<email_removed>> wrote:
>> On Tue, 4 Jul 2006 08:52:12 -0400, "Alan Smith" <<email_removed>>
>> 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.
>
>validateMenuItem: won't get called unless the system has already
>determined that your object responds to the action
Sorry about that. My "trick" depended upon some rather specialized
conditions that don't always inhere. m.
--
matt neuburg, phd = <email_removed>, <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>
| Related mails | Author | Date |
|---|---|---|
| Alan Smith | Jul 4, 14:52 | |
| mmalc crawford | Jul 4, 17:03 | |
| Matt Neuburg | Jul 4, 17:35 | |
| Michael Ash | Jul 5, 08:01 | |
| mmalc crawford | Jul 5, 08:11 | |
| Matt Neuburg | Jul 5, 18:29 | |
| Alan Smith | Jul 6, 00:54 | |
| mmalc crawford | Jul 6, 01:01 | |
| Shawn Erickson | Jul 6, 01:03 | |
| Matt Neuburg | Jul 6, 01:58 |






Cocoa mail archive

