Lisp HUG Maillist Archive

[CAPI] Sliders controlled by keys

  Hello,

I have a couple of sliders (on Cocoa) with somewhat large ranges, and
the mouse only gives so much precision. I'd like to additionally control
them with keys, e.g., left and right arrows, to decf and incf their
value respectively.

I've read the documentation on input models, but unfortunately, it seems
that sliders don't have an :input-model... Any ideas ?

Thanks !

-- 
Resistance is futile. You will be jazzimilated.

Jazz site:   http://www.didierverna.com
Other sites: http://www.didierverna.info

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

Hi,

If you want exact values, maybe slider is not the best control for it? There is another one called text-input-range which allow to enter precise and step in numbers: http://www.lispworks.com/documentation/lw71/CAPI-M/html/capi-m-648.htm#98357


Br,
/Alexey

On Wed, Apr 1, 2020 at 12:48 PM Didier Verna <didier@lrde.epita.fr> wrote:

  Hello,

I have a couple of sliders (on Cocoa) with somewhat large ranges, and
the mouse only gives so much precision. I'd like to additionally control
them with keys, e.g., left and right arrows, to decf and incf their
value respectively.

I've read the documentation on input models, but unfortunately, it seems
that sliders don't have an :input-model... Any ideas ?

Thanks !

--
Resistance is futile. You will be jazzimilated.

Jazz site:   http://www.didierverna.com
Other sites: http://www.didierverna.info

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

Hi,

> I'd like to additionally control them with keys, e.g., left and right arrows,
> to decf and incf their value respectively.

I don’t know about other platforms, but at least on cocoa, capi:slider are indeed controllable by the arrow keys by default! You can’t set a specific step size just for the arrow keys though, is that what you wanted?

Erik




> 1 apr. 2020 kl. 12:47 skrev Didier Verna <didier@lrde.epita.fr>:
> 
> 
>  Hello,
> 
> I have a couple of sliders (on Cocoa) with somewhat large ranges, and
> the mouse only gives so much precision. I'd like to additionally control
> them with keys, e.g., left and right arrows, to decf and incf their
> value respectively.
> 
> I've read the documentation on input models, but unfortunately, it seems
> that sliders don't have an :input-model... Any ideas ?
> 
> Thanks !

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

Erik Ronström <erik.ronstrom@doremir.com> wrote:

> I don’t know about other platforms, but at least on cocoa, capi:slider
> are indeed controllable by the arrow keys by default!

  Hmm. All right. This may be a focus problem then. In fact, I never
  payed attention to this until now. When the interface starts, I see
  that the first radio button at the top left appears to be selected
  (I've read this somewhere in the documentation indeed), but then,
  clicking anywhere else doesn't seem to move the focus.

  In fact, even within the first radio buttons pane, I can't seem to
  find a way to check another option with the keyboard. The only key
  that works is the space bar, which just reselects the already selected
  button.

  So I guess the question is: is there a simple way to install an
  application-wide "standard" interface control from the keyboard, or do
  I need to program everything myself (focus, gesture, whatever else)?

-- 
Resistance is futile. You will be jazzimilated.

Jazz site:   http://www.didierverna.com
Other sites: http://www.didierverna.info

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

Make sure you haven’t specified :accepts-focus-p nil for the sliders.

>  In fact, even within the first radio buttons pane, I can't seem to
>  find a way to check another option with the keyboard. The only key
>  that works is the space bar, which just reselects the already selected
>  button.

Doesn’t the TAB key work?

Running the following code, I can walk between the checkboxes with TAB:
(capi:contain (make-instance 'capi:check-button-panel :layout-class 'capi:column-layout :items '(1 2 3)))

However I can’t check the selected box with Space, so that I would consider a bug.

Erik


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

Erik Ronström <erik.ronstrom@doremir.com> wrote:

> Doesn’t the TAB key work?

  Nope.

> Running the following code, I can walk between the checkboxes with
> TAB: (capi:contain (make-instance 'capi:check-button-panel
> :layout-class 'capi:column-layout :items '(1 2 3)))

  The TAB key makes the focus disappear completely.

> However I can’t check the selected box with Space, so that I would
> consider a bug.

  Same here.

Perhaps I should mention now that I'm running LW Personal 6.1.1 on High
Sierra 10.13.6.

-- 
Resistance is futile. You will be jazzimilated.

Jazz site:   http://www.didierverna.com
Other sites: http://www.didierverna.info

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: [CAPI] Sliders controlled by keys

> Perhaps I should mention now that I'm running LW Personal 6.1.1 on High
> Sierra 10.13.6.

Ah, that may explain the differences: I’m on LW 7.1.2. Same version of macOS as you (10.13.6).

In my experience, the ”focus ring” generally works well in CAPI, although it is at times annoying that you cannot set the tab order explicitly.

As for the sliders, I implemented my own slider component, mostly to be able to customize the graphical appearance, but that also enables me to do various stuff such as logarithmic value ranges, resetting to default value on alt-click (which is common for faders in DAWs) etc. So that could still be one way to go.

Erik



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:29 UTC