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: Roland King <email@hidden>
- Date: Wed, 30 Dec 2015 08:31:30 +0800
>>
>> 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.
You don’t indeed - however if you add keyDown: as well and capture the current value (if you don’t already have one captured) you can decide whether anything actually changed on keyUp: or not. That avoids a spurious callback when you just tab through the field. Not that it matters in this implementation but it was easy to do.
Ok enough GUI fun, I better go write the actual bluetooth bit now
_______________________________________________
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