Re: Sent Actions, Delegates, Outlets
Re: Sent Actions, Delegates, Outlets
- Subject: Re: Sent Actions, Delegates, Outlets
- From: "Oleg Krupnov" <email@hidden>
- Date: Thu, 24 Jul 2008 09:28:29 +0300
On Thu, Jul 24, 2008 at 9:15 AM, Graham Cox <email@hidden> wrote:
>
> On 24 Jul 2008, at 3:58 pm, Oleg Krupnov wrote:
>
>> Currently the "Sent Actions" section does not even appear in my custom
>> view's connections menu at all, how would I make it appear?
>
>
> To clarify: the reason it's not listed is because the built-in support is
> for NSControl and its subclasses. If you are just subclassing a plain
> NSView, there is no built-in support for target/action, though it's quite
> straightforward to implement from scratch - just add a setTarget: and
> setAction: method in your view, save the parameters in ivars and then use
> [NSApp sendAction:to:from:] to invoke it.
Now I see, the target/action is specific for NSControl and not for
NSView, I haven't noticed it before.
> I suspect that this might be a blind alley though - what are you trying to
> actually do? Likely that NSNotificaiton could be more suitable.
Notifications is another point of confusion for me. I would assume
that notifications should be used when multiple observers can be
connected to an "event" exposed by an object, in contrast to a simple
"delegate" outlet, which can only have one connected object. Am I
correct?
What I am actually trying to do is to build a custom editor view that
would notify it's parent window when the state of the view changes,
e.g. due to user actions. I think delegate is the right choice,
correct?
Thanks!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden