Lisp HUG Maillist Archive

Input Model

Hi all,

After a few hours digging into output-pane's input-model, it's still very
confusing to me.
I want to be able to dispatch actions directly from the input model when the
user press different combination of keys with their associated modifiers
(and not later in the callback).

what i did :
------------
(defun cb (pane x y key gesture) (capi:display-message "cb called"))

(capi:contain (make-instance 'capi:output-pane :input-model '(((#\r) cb))))
==> OK

(capi:contain (make-instance 'capi:output-pane :input-model '(((#\r
:control) cb))))
==> In LOGIOR of (#\r 1048576) arguments should be of type INTEGER.
NOTE : According to my understanding of the doc (i'm not an english native
speaker as you could guess...) this should be possible.

(capi:contain (make-instance 'capi:output-pane :input-model
'(((:gesture-spec #\r :control) cb))))
==> OK, there is no more distinction between #\r and #\R

(capi:contain (make-instance 'capi:output-pane :input-model
'(((:gesture-spec #\r :shift) cb))))
==> NOTHING HAPPENS ???


Is there anybody that knows how all this function ?

Sebastien.


Unable to render article 2322 because of ":DEFAULT stream decoding error on #<SB-SYS:FD-STREAM for \"socket 192.168.43.216:64744, peer: 116.202.254.214:119\" {10037F8B23}>: the octet sequence #(233 98 97) cannot be decoded." error

RE: Input Model

Hi,

> If I change your definition of cb to drop the argument "gesture"
>
> (defun cb (pane x y key) (capi:display-message "cb called"))

OK, bad cut & paste from an oldier definition

>
> the following examples work for me on LWL:
>
> (capi:contain (make-instance 'capi:output-pane :input-model
> '(((#\R :shift)
> cb))))
>

Under LWW PRO 4.2.7 & LWW PER 4.3.6  ==> In LOGIOR of (#\R 524288) arguments
should be of type INTEGER.

> (capi:contain (make-instance 'capi:output-pane :input-model
> '(((#\control-\r)
> cb))))
>

This is OK, except that there is no distinction between lower & upper case
(LWW).
Moreover, I've read this from the example as following

4.3 ==> OK         ((#\control-\a) ;this is the one you will see
                    char-input-callback
                    "Ctrl-a")

4.2 ==> buggy      ((#\a :control) ;this is the one you will see
                    char-input-callback
                    "Ctrl-a")

But according to the doc, the 4.2 notation is the documented one.


> (capi:contain (make-instance 'capi:output-pane :input-model
> '(((#\r) cb))))
>
> There are some examples in the Lispworks directory
> ..../examples/capi/output-panes/input-model.lisp
>
> pt
>

Thanks Paul,

Sebastien.



Re: Input Model

Unable to parse email body. Email id is 2327

Unable to render article 2329 because of ":DEFAULT stream decoding error on #<SB-SYS:FD-STREAM for \"socket 192.168.43.216:64746, peer: 116.202.254.214:119\" {1005E48683}>: the octet sequence #(233 32 58) cannot be decoded." error

Re: Input Model

   One question remains open (maybe I should have asked it explicitly...):
   How do I handle the "ALT" key under LWW ? I tried the keyword :meta without
   any success.

By default on Windows the Alt key gets used for Windows-specific
purposes such as invoking menu shortcuts.

You can override this by telling your interface to interpret Alt as a
Meta key, see the CAPI Reference Manual entry
CAPI:INTERFACE-KEYS-STYLE for more details of this. Quick example:

(defun cb (pane x y key ) (capi:display-message "cb called"))

(capi:define-interface sebastien ()
  ()
  (:panes
   (output-pane 
    capi:output-pane
   :input-model '(((:gesture-spec #\R :meta) cb))))
  (:default-initargs
   :title "Sebastien"))

(defmethod capi:interface-keys-style ((self sebastien))
  :emacs)

(capi:contain (make-instance 'sebastien))

   Sebastien.

   > -----Message d'origine-----
   > De : owner-lisp-hug@xanalys.com [mailto:owner-lisp-hug@xanalys.com]De la
   > part de davef@xanalys.com
   > Envoyé : vendredi 14 mai 2004 13:52
   > À : sebastien.saint-sevin@ALINEA.NET
   > Cc : lisp-hug@xanalys.com
   > Objet : Re: Input Model
   >
   >
   >
   >    After a few hours digging into output-pane's input-model, it's
   > still very
   >    confusing to me.
   >    I want to be able to dispatch actions directly from the input
   > model when the
   >    user press different combination of keys with their associated
   > modifiers
   >    (and not later in the callback).
   >
   >    what i did :
   >    ------------
   >    (defun cb (pane x y key gesture) (capi:display-message "cb called"))
   >
   >    (capi:contain (make-instance 'capi:output-pane :input-model
   > '(((#\r) cb))))
   >    ==> OK
   >
   >    (capi:contain (make-instance 'capi:output-pane :input-model '(((#\r
   >    :control) cb))))
   >    ==> In LOGIOR of (#\r 1048576) arguments should be of type INTEGER.
   >    NOTE : According to my understanding of the doc (i'm not an
   > english native
   >    speaker as you could guess...) this should be possible.
   >
   > Yes, the doc is not clear and your form does work on some
   > platforms. Character gestures are obsolescent (see below) but FWIW the
   > intent was that you put the modifiers in the character object:
   >
   > (capi:contain (make-instance 'capi:output-pane
   >                              :input-model
   >                              '((#\control-\r cb))))
   >
   >
   >    (capi:contain (make-instance 'capi:output-pane :input-model
   >    '(((:gesture-spec #\r :control) cb))))
   >    ==> OK, there is no more distinction between #\r and #\R
   >
   >    (capi:contain (make-instance 'capi:output-pane :input-model
   >    '(((:gesture-spec #\r :shift) cb))))
   >    ==> NOTHING HAPPENS ???
   >
   > That's because for Gesture Specs representing BOTH-CASE-P characters,
   > the case is expressed in the data, not the modifiers. Your form above
   > will generate an error in the next release, and should instead be
   > expressed like this:
   >
   > (capi:contain (make-instance 'capi:output-pane
   >                              :input-model
   >                              '(((:gesture-spec #\R) cb))))
   >
   > The :SHIFT modifier can be used in Gesture Specs not representing
   > BOTH-CASE-P characters.
   >
   >    Is there anybody that knows how all this function ?
   >
   > Use :GESTURE-SPEC to match keyboard input in the input-model. Gesture
   > Specs portably support modifier keys (unlike Common Lisp character
   > objects) and will be fully documented in the next release. Hopefully
   > the examples here suffice for the moment.
   >
   > (in-package "CL-USER")
   >
   > (capi:define-interface test-input-model
   >     (capi:interface)
   >
   >   ()
   >   (:panes
   >    (typein-pane
   >     capi:output-pane
   >     :title "Input"
   >     :title-position :frame
   >     :background :black
   >     :foreground :white
   >     :input-model `((:gesture-spec
   >                     gspec-input-callback
   >                     "Any gspec")
   >                    ((:gesture-spec #\x)
   >                     gspec-input-callback
   >                     "x gspec")
   >                    ((:gesture-spec #\x :control)
   >                     gspec-input-callback
   >                     "Control-x gspec")))
   >
   >    (display-pane
   >     capi:display-pane
   >     :title "Callback Info"
   >     :title-position :frame
   >     :visible-max-width nil))
   >   (:layouts
   >    (main-layout
   >     capi:column-layout
   >     '(typein-pane display-pane)))
   >   (:default-initargs
   >    :layout 'main-layout
   >    :title "Input Model Test"
   >    :best-width 400
   >    :best-height 400))
   >
   >
   > (defun display-message (self message)
   >   (let ((interface (capi:element-interface self)))
   >     (with-slots (display-pane)
   >         interface
   >       (setf (capi:display-pane-text display-pane)
   >             message))))
   >
   > (defun gspec-input-callback (self x y key type)
   >   (display-message self type)
   >   (gp:draw-character self (sys::gesture-spec-to-simple-char key) x y))
   >
   > (capi:contain (make-instance 'test-input-model))
   >
   >
   > --
   > Dave Fox
   >
   > Xanalys                 http://www.lispworks.com
   > Compass House
   > Vision Park, Chivers Way
   > Histon
   > Cambridge, CB4 9AD
   > England
   >
   >

--
Dave Fox			

Xanalys                 http://www.lispworks.com
Compass House
Vision Park, Chivers Way
Histon
Cambridge, CB4 9AD
England


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