Re: Getting the final value from an NSSlider drag
Re: Getting the final value from an NSSlider drag
- Subject: Re: Getting the final value from an NSSlider drag
- From: Lee Ann Rucker <email@hidden>
- Date: Wed, 30 Dec 2015 00:23:29 +0000
- Thread-topic: Getting the final value from an NSSlider drag
> On Dec 29, 2015, at 3:51 PM, Roland King <email@hidden> wrote:
>
>
>> On 30 Dec 2015, at 05:53, Lee Ann Rucker <email@hidden> wrote:
>>
>>
>>>
>>
>>
>> Actually it's easy. For very similar reasons I needed the same behavior - live update of the slider's temp value for UI elements, but only call the final setter when the user is done. I subclassed NSSlider's keyUp: and keyDown: to call super and then call my own delegate method "sliderDidEndUpdate:"
>>
>
> Never drove a slider with the keyboard before, so I added a keyDown and keyUp method to the mouseDown: one I posted earlier, with a bit of code to try and be smart about when to send updates, so you don’t get them if you’re just tabbing though. Seems to work well enough for this use-case, keyboard and mouse, live update on the screen, one update at the end, 15 lines of code and no need to artificially compress the events.
Whoops, how did I not notice that - it should've been keyUp and mouseDown! You don't need keyDown because nothing changes until keyUp, but mouseDown won't return until the mouse goes up.
_______________________________________________
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