[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] -setTarget: and -setAction: enabled in NSImageView

From: Alexander Malmberg
Subject: Re: [PATCH] -setTarget: and -setAction: enabled in NSImageView
Date: Tue, 23 Dec 2003 21:53:19 +0100

Kazunobu Kuriyama wrote:
> Hi,
> Because no one gives me any solution to my problem on NSImageView,
> I offer my own here. They simply makes NSImageView enable
> target/action without raising an exception.

Not really; they also make it send the action when an image is dropped
on it, but that's the point of the behavior change, so that's ok. :)

> I hope these tiny paches fix the problem (at least for the
> example source I mentioned).
> I hope they do no harm to the rest of the library.
> I would appreciate it if someone could confirm this.

>address@hidden NSImageCell : NSCell
>address@hidden NSImageCell : NSActionCell

This is a very dubious change. The design is sane, but it's a pretty big
change, and it's against the docs. I'm going to think about it for a
while and let others comment on it.

As it is, it also breaks decoding of old NSImageCell:s, which is
definitely not ok. If we decide to make this change, -initWithCoder:
will have to be updated to handle it.

> +      [target performSelector: action];

This is wrong. You need to handle nil targets, nil actions, the sender
argument, etc. To send an action, use [self sendAction: action  to:
target]. It will handle all that for you.

- Alexander Malmberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]