[cells-devel] Celtk: Double click not being sent to Cello
Frank Goenninger
frgo at me.com
Sun May 24 14:19:26 UTC 2009
Hi -
I have:
(eval-when (:compile-toplevel :load-toplevel :execute)
(defparameter *tcl-bindings* nil)
(defun make-binding (tcl-event tcl-command-string)
(let ((tcl-binding (conc$ "bind . " tcl-event " " tcl-command-
string)))
(pushnew tcl-binding *tcl-bindings*))))
(defun apply-bindings (&optional (bindings *tcl-bindings*))
(loop for binding in bindings
do
(format *debug-io* "Celtk: Applying binding ~S.~%" binding)
(tk-format-now binding)))
(defmacro defbinding (tcl-event tcl-command-string)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(make-binding ,tcl-event ,tcl-command-string)))
(defmacro define-binding-and-command (command tcl-event tcl-command-
string)
`(progn
(defcommand ,command)
(defbinding ,tcl-event ,tcl-command-string)))
(define-binding-and-command double-click-1
"<Double-ButtonPress-1>"
"{do-double-click-1 %W %K; break}")
(define-binding-and-command double-click-2
"<Double-ButtonPress-2>"
"{do-double-click-2 %W %K; break}")
(define-binding-and-command double-click-3
"<Double-ButtonPress-3>"
"{do-double-click-3 %W %K; break}")
and have extended #'run-window to call #'apply-bindings. Trace output
shows that the bindings are actually executed as expected. I also
extended class tk-object to have appropriate slots:
(defmodel tk-object (model)
((.md-name :cell nil :initform (gentemp "TK") :initarg :id)
(tk-class :cell nil :initform nil :initarg :tk-class :reader tk-
class)
(timers :owning t :initarg :timers :accessor timers :initform nil)
(on-command :initarg :on-command :accessor on-command :initform nil)
(on-key-down :initarg :on-key-down :accessor on-key-down :initform
nil
:documentation "Long story. Tcl C API weak for keypress events.
This gets dispatched
eventually thanks to DEFCOMMAND")
(on-key-up :initarg :on-key-up :accessor on-key-up :initform nil)
(on-double-click-1 :initarg :on-double-click-1 :accessor on-double-
click-1 :initform nil) ;; <<< --- here
(on-double-click-2 :initarg :on-double-click-2 :accessor on-double-
click-2 :initform nil) ;; <<< --- and here
(on-double-click-3 :initarg :on-double-click-3 :accessor on-double-
click-3 :initform nil) ;; <<< --- and here
(user-errors :initarg :user-errors :accessor user-errors :initform
nil)
(tile? :initform t :cell nil :reader tile? :initarg :tile?))
(:documentation "Root class for widgets and (canvas) items"))
From the code I am reading that if any of the slots on-double-
click-1 ... is assigned a function this function gets called as soon
as a double-click-n is received... Yet Celtk always delivers a normal
ButtonPress event ...
Do I need to extend #'widget-event-handle of Celtk to make this work?
Kenny, did this ever work for you?
Any ideas ? Thx!
Best,
Frank
--
Frank Goenninger
Cell: +49 175 4321058
E-Mail: frgo at me.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2227 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cells-devel/attachments/20090524/5344855d/attachment.bin>
More information about the cells-devel
mailing list