• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Suggestions for forcing NSSlider to some values, without tickmarks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestions for forcing NSSlider to some values, without tickmarks


  • Subject: Re: Suggestions for forcing NSSlider to some values, without tickmarks
  • From: Conrad Shultz <email@hidden>
  • Date: Thu, 01 Mar 2012 19:14:31 -0800

On 3/1/12 4:13 PM, Graham Cox wrote:
>
> On 02/03/2012, at 11:00 AM, Sean McBride wrote:
>
>> Any suggested subclassing points?  That's where I'm stuck really...
>
>
>
> Wait. If you only set one tick mark, it is centred anyway.... does that not do the job for you?

Setting a tick mark has no effect on behavior (e.g. snapping to value)
unless you also tell it to only stop on tick marks, which is not what
Sean wants.

A quick solution I found (tested on 10.7) without subclassing is to set
the slider to update continuously and then implement its selector as, e.g.,

- (void)sliderDidSlide:(id)sender
{
    NSNumber *value = [sender objectValue];
    double dblValue = [value doubleValue];
    if (fabs(dblValue) < 5) {
        [sender setObjectValue:[NSNumber numberWithInt:0]];
    }
}

This causes a "snap" effect, but (somewhat to my surprise) does allow
you to drag farther and get out of the "snap zone."

--
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
_______________________________________________

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


References: 
 >Suggestions for forcing NSSlider to some values, without tickmarks (From: Sean McBride <email@hidden>)
 >Re: Suggestions for forcing NSSlider to some values, without tickmarks (From: Graham Cox <email@hidden>)
 >Re: Suggestions for forcing NSSlider to some values, without tickmarks (From: Sean McBride <email@hidden>)
 >Re: Suggestions for forcing NSSlider to some values, without tickmarks (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Xcode - An Apple Embarrassment
  • Next by Date: Re: Xcode - An Apple Embarrassment
  • Previous by thread: Re: Suggestions for forcing NSSlider to some values, without tickmarks
  • Next by thread: Re: Suggestions for forcing NSSlider to some values, without tickmarks
  • Index(es):
    • Date
    • Thread