Arrow Keys in NSSlider
In a window are multiple views. One view contains an NSSlider. I would like to move the slider with arrow keys. I have subclassed NSSlider, added a -keyDown: method,and -acceptsFirstResponder that returns YES. -keyDown is not being called. What more do I need do ? -rags ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Arrow Keys in NSSlider
NSSlider does normally respond to keystrokes if you’ve turned on Full Keyboard Access in System Prefs > Keyboard > Shortcuts. If it works with that but not with your changes, it’s doing something complicated you’ll have to adjust for. I’ve only subclassed it to enhance the snapping behavior, I never tried to make it work with FKA off. On Sep 8, 2015, at 1:28 PM, Raglan T. Tigerwrote: > In a window are multiple views. One view contains an NSSlider. I would like > to move the slider with arrow keys. > > I have subclassed NSSlider, added a -keyDown: method,and > -acceptsFirstResponder that returns YES. > > -keyDown is not being called. > > What more do I need do ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Arrow Keys in NSSlider
> On 8 Sep 2015, at 21:28, Raglan T. Tigerwrote: > > In a window are multiple views. One view contains an NSSlider. I would like > to move the slider with arrow keys. > > I have subclassed NSSlider, added a -keyDown: method,and > -acceptsFirstResponder that returns YES. > > -keyDown is not being called. > > What more do I need do ? What sort of event is actually taking place to make the slider the first responder? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Arrow Keys in NSSlider
On Sep 8, 2015, at 13:28 , Raglan T. Tigerwrote: > > What more do I need do ? It’s hard to say, but at the very least you’ll actually need to *make* the NSSlider first responder, which means you’ll have to click it first or tab to it. You also don’t say what you think should happen if arrow keys should be pressed when some other view (e.g. a text field) is first responder. Most likely, your solution will involved the following: — Implement ‘keyDown’ in a view or controller higher up in the responder chain, an object that normally doesn’t respond to keystrokes. — In your ‘keyDown’ override, invoke ‘interpretKeyEvents’ to handle the arrow keys. — In a suitable controller class (possibly the same one), implement ‘moveUp/Down/Left/Right:’ action methods to deal with the slider. — Filter out or reroute other events that aren’t relevant. See the Cocoa Event Handling Guide (Handling Key Events) for more details. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Arrow Keys in NSSlider
Coolio, I will get on these suggestion, thx! -rags > On Sep 8, 2015, at 2:47 PM, Quincey Morris >wrote: > > On Sep 8, 2015, at 13:28 , Raglan T. Tiger wrote: >> >> What more do I need do ? > > It’s hard to say, but at the very least you’ll actually need to *make* the > NSSlider first responder, which means you’ll have to click it first or tab to > it. > > You also don’t say what you think should happen if arrow keys should be > pressed when some other view (e.g. a text field) is first responder. > > Most likely, your solution will involved the following: > > — Implement ‘keyDown’ in a view or controller higher up in the responder > chain, an object that normally doesn’t respond to keystrokes. > > — In your ‘keyDown’ override, invoke ‘interpretKeyEvents’ to handle the arrow > keys. > > — In a suitable controller class (possibly the same one), implement > ‘moveUp/Down/Left/Right:’ action methods to deal with the slider. > > — Filter out or reroute other events that aren’t relevant. > > See the Cocoa Event Handling Guide (Handling Key Events) for more details. > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net > > This email sent to k...@highrolls.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com