Re: Was: Re: NSStepper - useless?
Re: Was: Re: NSStepper - useless?
- Subject: Re: Was: Re: NSStepper - useless?
- From: Keary Suska <email@hidden>
- Date: Thu, 23 Feb 2012 15:11:32 -0700
On Feb 23, 2012, at 10:05 AM, Kyle Sluder wrote:
> On Thu, Feb 23, 2012 at 6:16 AM, William Squires <email@hidden> wrote:
>> From what I've read, the NSStepper has a bug (though practically, you'll never see it); if one were to click the up or down arrow on the control 2^32 times (assuming it's value is a 4-byte signed int,and is initialized to 0), it would wrap around (or raise an exception for integer overflow). Probably not what the user had in mind! Why didn't they just make the NSStepper a custom view that draws two arrows, and has two sent actions that you can connect? Or even a variation of NSMatrix with two button cells that look like arrows. That would avoid the problem entirely, and be more intuitive to use.
>
> Because NSStepper is over 20 years old, dating back to when the way to
> push values around was to wire up a control's action to another
> control's -takeValueFrom: method. Besides, all sorts of crazy things
> tend to happen anyway when you try to use UINT_MAX for anything
> useful.
Not to mention that this is really a programmer error. If you don't wan the value to overflow, set a sensible maximum. A similar issue could happen from any user-entry field. It's the developer's responsibility (IMHO) to set data entry constraints.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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