Lisp HUG Maillist Archive

Return/Enter in dialogs

Hi folks,

Usually it is possible to dismiss dialogs by pressing Return or Enter (for OK) or Escape (for cancel). However if I make a CAPI dialog with a text-input-pane, that pane's callback would be called when pressing Enter, and the dialog won't close until I hit Enter a second time. Of course, I can set :callback of the text-input-pane, but it can be a tedious work if there are many dialogs, and furthermore, that approach won't work at all for e.g. a multi-column-list-panel, which lacks a callback slot.

So, my questions are

1) Is it possible to have a general dispatch of the Enter/Return key in a dialog, so that it *always* emulates the button marked with :default-p?

2) Is it possible to catch the Return/Enter key in a multi-column-list-panel, and other panes lacking such a callback?

Regards
Erik


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


Re: Return/Enter in dialogs

Erik Ronström wrote on Mon, 11 Feb 2013 11:05:43 +0100 14:05:

| Usually it is possible to dismiss dialogs by pressing Return or Enter
| (for OK) or Escape (for cancel). However if I make a CAPI dialog with a
| text-input-pane, that pane's callback would be called when pressing
| Enter, and the dialog won't close until I hit Enter a second time. Of
| course, I can set :callback of the text-input-pane, but it can be a
| tedious work if there are many dialogs, and furthermore, that approach
| won't work at all for e.g. a multi-column-list-panel, which lacks a
| callback slot.
|
| So, my questions are
|
| 1) Is it possible to have a general dispatch of the Enter/Return key in
| a dialog, so that it *always* emulates the button marked with
| :default-p?

In my experience, :default-p usually works on Windows if the callback is not
specified for the pane and there is a visible pane with focus.

| 2) Is it possible to catch the Return/Enter key in a
| multi-column-list-panel, and other panes lacking such a callback?

Some panes also have :action-callback.
Some intercept and muffle pressing the Return/Enter or Escape key.
For an output pane, the corresponding gestures should be specified by means
of the input model.
--
Sincerely,
Dmitry Ivanov
lisp.ystok.ru


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


Re: Return/Enter in dialogs

On 13-02-11 05:05 AM, Erik Ronström wrote:
> ...time. Of course, I can set :callback of the text-input-pane, but it can be a tedious work if there are many dialogs,

Subclass text-input-pane with a variant that defaults to what you want, 
then use it everywhere instead of text-input-pane.

> ...
> 2) Is it possible to catch the Return/Enter key in a multi-column-list-panel, and other panes lacking such a callback?
Have a look at alternative-action-callback.lisp example.  It appears to 
accept RETURN's.

pt

_______________________________________________
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:35 UTC