Re: Simple Interface Connection Question
Re: Simple Interface Connection Question
- Subject: Re: Simple Interface Connection Question
- From: Keary Suska <email@hidden>
- Date: Wed, 25 Apr 2007 13:42:30 -0600
- Thread-topic: Simple Interface Connection Question
on 4/25/07 2:34 AM, email@hidden purportedly said:
> Another, usually conceptually cleaner approach is to take advantage
> of the responder chain. E.g. if you want a menu item in your
> MainMenu.nib to point at an action used by a window in another NIB,
> just connect it to the "first responder" icon and implement it in
> your window controller for that window in the other NIB. When the
> responder chain is searched during menu updating, it will then find
> that window if it's open and enable the menu item appropriately. Very
> simple once one gets one's head around it, and very powerful. Not to
> mention many windows can share the same menu item to do the same
> thing in the way that's most appropriate for them.
Just to add a clarifying point, since the OP didn't specify action messages,
but instead connections: this approach would be conceptually cleaner if--and
in many cases *only* if--the messages are action messages *and* the target
object is in the responder chain. An object won't be in the responder chain
if it isn't an NSView, NSWindow/Controller, NSDocument/Controller, or a
delegate to an NSWindow or NSApplication (IIRC).
If you aren't sending action messages, and/or your object isn't in the
responder chain, it doesn't seem conceptually clearer to me to use nil
targeted actions (which you couldn't anyway if your messages don't match the
action message signature).
But, as Uli indicated, if you want, for instance, to have a menu that
invokes a method on an object in various nibs, the approach above (aka nil
targeted actions) is best.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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