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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to