Lisp HUG Maillist Archive

Multi-line-text-input-pane and the Return key

Hi!

Is there a way to catch when the user presses the Return key in 
multi-line-text-input-pane? Then I need to remove the pane. At the same 
time, Ctrl+Return should work as usual, i.e. a caret should go to the 
next line.

The rationale is as follows. This is a diagram editor. When double 
clicking the mouse on a text block, a new multi-line-text-input-pane is 
created directly in the diagram. When pressing Ctrl+Return, the caret 
should go to the next line in the pane. When pressing Return only, the 
multi-line-text-input-pane must be deleted and the text block must be 
set a new value. When pressing Esc, the changes must be cancelled and 
the pane must be removed from the diagram too.

I try to define the :gesture-callbacks initarg. Pressing on the Esc 
button is caught successfully but I cannot catch pressing the Return 
button. I need namely a multi line text input.

Thanks,
David

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


Re: Multi-line-text-input-pane and the Return key

This is very strange. I just tested on Windows. Before it I tested on 
Linux. So, gesture #\Return works on Windows but doesn't work on Linux 
in my case. At the same time, gesture #\Esc (or, #\Escape ?) works on 
Linux but doesn't work on Windows... I only define the 
:gesture-callbacks initarg. Here I use LW Profession 32-bit for Windows 
and LW Personal for Linux.

Thanks,
David

18.05.2013 12:30, David Sorokin пишет:
>
> Hi!
>
> Is there a way to catch when the user presses the Return key in 
> multi-line-text-input-pane? Then I need to remove the pane. At the 
> same time, Ctrl+Return should work as usual, i.e. a caret should go to 
> the next line.
>
> The rationale is as follows. This is a diagram editor. When double 
> clicking the mouse on a text block, a new multi-line-text-input-pane 
> is created directly in the diagram. When pressing Ctrl+Return, the 
> caret should go to the next line in the pane. When pressing Return 
> only, the multi-line-text-input-pane must be deleted and the text 
> block must be set a new value. When pressing Esc, the changes must be 
> cancelled and the pane must be removed from the diagram too.
>
> I try to define the :gesture-callbacks initarg. Pressing on the Esc 
> button is caught successfully but I cannot catch pressing the Return 
> button. I need namely a multi line text input.
>
> Thanks,
> David
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
>
>
>


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


Re: Multi-line-text-input-pane and the Return key

I recall doing something along these lines several years ago (probably 
to detect loss of focus).

Look at :navigation-callback and :editing-callback and build a state 
machine that tracks the state of the widget.  FWIW, here's a note from 
my code (LWW):

(defclass text-input-pane (capi:text-input-pane)
   ((state :initform nil)
    (ended :initform nil)  ;; correction for inconsistent state change 
(see states below)
    (model-update-callback :initarg :model-update-callback)
    (model-slot :initarg :model-slot)
    (fmt :initarg :fmt))
   (:default-initargs
    :callback-type :interface-item
    :callback 'tip-fini
    :model-slot nil
    :buttons '(:ok t :cancel t :cancel-function tip-cancel)
    :fmt "~,4F"
    :navigation-callback 'tip-editing
    :editing-callback 'tip-editing))

;; possible paths vs. callbacks
;; edit, hit enter -> START, RETURN, END
;; edit, hit TAB -> START, TAB-FORWARD, END
;; edit, click to focus elsewhere -> START, END
;; edit, click check-mark -> START, tip-fini
;; edit, click check-mark, call do-update -> START, tip-fini, END

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