Re: Adding a new type of NSButton
Re: Adding a new type of NSButton
- Subject: Re: Adding a new type of NSButton
- From: "I. Savant" <email@hidden>
- Date: Wed, 25 Jun 2008 16:26:22 -0400
> Other peoples comments about this being a "Controller" problem and not
> something that belongs in the Model are somewhat true, but if this is really
> a button type your going to use in several places then subclassing is
> perfectly appropriate. Also, if it's important to you that the user not get
> any click behavior (that is, once the button has been "set" then clicking on
> it again has no visible effect on the control), then I don't think you'll be
> able to get what you want without subclassing.
Incorrect. For several reasons.
First, my comments had nothing to do with the model layer (this
logic most definitely doesn't belong in the model layer).
Second, why should the view (a button), which already knows how to
track its on/off (pressed/not-pressed) and enabled/disabled states, as
well as how to use custom images if necessary, care *at all* about a
special case where it can only ever be pressed once (set to "on" and
then "!enabled")? The MVC answer: It shouldn't. Ever.
Third, regarding MVC, the view layer is supposed to be the most
reusable. In this case, you're suggesting that application-specific
logic be added to an existing view that can already do what's needed
(be pressed and disabled), rather than to the controller layer (which
can tell it "in this case, once pressed, stay pressed - ie, set to on
and disabled). Presumably, when the button is first pressed, it's
firing an action ... all you need is two extra lines of code in that
action to solve this problem (appearance notwithstanding).
--
I.S.
_______________________________________________
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