Re: number box class from NSTextField
Re: number box class from NSTextField
- Subject: Re: number box class from NSTextField
- From: Graham Cox <email@hidden>
- Date: Tue, 23 Jun 2009 01:11:25 +1000
On 23/06/2009, at 1:02 AM, Stephen Blinkhorn wrote:
I need a scrolling number box type object for my GUI. At the moment
I am subclassing NSTextField and overriding mouse and scroll wheel
events so a user can drag the numeric value up/down. This seems a
bit clumsy somehow.
Perhaps a better idea would be a custom view that sits invisibly
above an NSTextField taking mouse events and passing the numeric
value to the text field via setFloatValue messages.
Any comments? I'm sure a few people must have made something
similar - I'm surprised there isn't a standard Cocoa object like
this already.
The standard way to handle this is to pair an ordinary text field with
a stepper control (and maybe a slider, if you have space). The stepper
allows the user to spin the value up or down while the text field
allows them to type a value. I doubt that even if you get your field
working properly, anyone will expect it to work the way you describe,
and it will be very frustrating to have the value changing when they
just tried to click and drag to select it.
Very unusual UI widgets are not "standard" usually for very good
reasons.
--Graham
_______________________________________________
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