On Oct 25, 2008, at 11:20 AM, john fogg wrote:

I create a Button and in the course of that I set a "target:" and an
"action:". Unlike any and all of the examples I found on the web and
on Apple's site I don't want the message sent to my current object, so
I don't want "target:self" but another object I created elsewhere from
another class.

How do I do that?


Call -setTarget: on the button with a pointer to the other object, like this: (warning, written in Mail, untested, use at your own risk, etc.)

---
NSButton *button;       // initialize this elsewhere
MyWonderfulObject *otherObject; // ditto above

[button setTarget:otherObject];
---

Or, if you're targeting Leopard & later only:

---
NSButton *button;
MyWonderfulObject *otherObject;

button.target = otherObject;
---

Nick Zitzmann
<http://www.chronosnet.com/>



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to