• 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: Getting the final value from an NSSlider drag
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the final value from an NSSlider drag


  • Subject: Re: Getting the final value from an NSSlider drag
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 29 Dec 2015 16:45:44 -0600

On Dec 29, 2015, at 5:44 AM, Graham Cox <email@hidden> wrote:
>
> On 29 Dec 2015, at 7:44 PM, Roland King <email@hidden> wrote:
>>
>> I can subclass NSSlider or possibly NSSliderCell but that sounds like a whole world of pain, if I have to do that I’ll probably just put a coalescing delay into the whole thing which waits 1/2 second after an update before it actually does the update.
>>
>> Any good ways to do this?
>
> In your action method, call another method that handles the final value using -performSelector:withObject:afterDelay: but just before you do that, call +[NSObject cancelPreviousPerformRequestsWithTarget:...] for the same message. This schedules a deferred message but immediately cancels it as long as the values come pouring in. On the last time, when you stop moving the slider, the final -performSelector will get to its target and do its work. The afterDelay parameter can be set to whatever value you think you’ll need to allow for a slowly moved slider NOT to fire the final message. I typically use 0.1sec.

This gives false positives if the user simply stops moving the mouse but doesn't release the mouse button.  There's no delay you can specify that avoids this, since there's no upper bound to how long the user can hold the mouse button.  (With assistive technologies, the user doesn't even have to be actually holding anything for the duration.)

Regards,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: Getting the final value from an NSSlider drag
      • From: Graham Cox <email@hidden>
    • Re: Getting the final value from an NSSlider drag
      • From: Uli Kusterer <email@hidden>
    • Re: Getting the final value from an NSSlider drag
      • From: Doug Hill <email@hidden>
References: 
 >Getting the final value from an NSSlider drag (From: Roland King <email@hidden>)
 >Re: Getting the final value from an NSSlider drag (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Getting the final value from an NSSlider drag
  • Next by Date: Re: Getting the final value from an NSSlider drag
  • Previous by thread: Re: Getting the final value from an NSSlider drag
  • Next by thread: Re: Getting the final value from an NSSlider drag
  • Index(es):
    • Date
    • Thread