Re: Suggestions for forcing NSSlider to some values, without tickmarks
Re: Suggestions for forcing NSSlider to some values, without tickmarks
- Subject: Re: Suggestions for forcing NSSlider to some values, without tickmarks
- From: Graham Cox <email@hidden>
- Date: Fri, 02 Mar 2012 10:31:29 +1100
On 02/03/2012, at 8:18 AM, Sean McBride wrote:
> Hi all,
>
> I have a continuous linear NSSlider who's range is -180 to 180 degrees. I don't want tick marks because any value is acceptable. However, the value zero is important, and I need for the user to be able to get to exactly 0.0 (0.1 or whatever is no good).
>
> How would you suggest accomplishing this?
>
> (In the past, I cheated and forced the slider to be an even number of pixels long, which did the job. This fragile solution broke in 10.7.)
You could just round the values received to the nearest whole number.
I guess what might be nice is a tendency for it to "snap" to the zero position when the slider is dragged close to it. You might be able to do that with a standard slider by manipulating the values close to the zero point, but to get this really working well you'd probably want a subclass of NSSliderCell - you'd probably also want to have some sort of override, such as when the option key is pressed, otherwise it will be impossible to set values very close to 0, such as 1.
--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