Hi again,
When using the mk-entry widget I seem to not get any value back:
CL-USER> (et::run-entry-test)
"----------UTILSRESET----------------------------------" *** Tk_AppInit has been called. *** OBSERVER VAL: slot 'val' of ENTRY-TEST set to NIL 0> entry | "md-value output" | ENTRY | "" tk> bind . <Escape> {destroy .} 0> no event handlers for | ENTRY | |write| 0> known key | CTK::|write| | SYMBOL 0> no event handlers for | ENTRY | |write| 0> known key | CTK::|write| | SYMBOL *** OBSERVER VAL: slot 'val' of ENTRY-TEST set to 0> tcl-do-one-event-loop has left the building NIL CL-USER>
In order to get this output I turned on trc output in the defobserver .mdvalue ((self entry)) method. Yet the observer does not fire. When should/does the observer fire? On each change of the entry's entry field ?
I used the following code to test (also attached as a file):
(defpackage :et (:use :common-lisp))
(in-package :et)
(eval-when (:load-toplevel :compile-toplevel :execute) #+asdf (progn #-cells (progn (asdf:operate 'asdf:load-op :cells) (use-package :cells)) #-cl-opengl (progn (asdf:operate 'asdf:load-op :cl-openg)) #-Celtk (progn (asdf:operate 'asdf:load-op :Celtk) (use-package :Celtk)) ))
(defmodel entry-test (window) ((val :accessor val :initarg :val :initform (c-in nil))) (:default-initargs :title$ "entry test" :id :entry-test :kids (c? (the-kids (mk-row (:packing (c?pack-self)) (mk-label :text "Enter value:") (mk-entry :id :frgo-entry) (mk-button-ex ("Do it !" (setf (val (fm^ :entry-test)) (md-value (fm^ :frgo-entry))))))))))
;;; DEBUG OBSERVERS
(defobserver val ((self entry-test)) (format t "~&*** OBSERVER VAL: slot 'val' of ~S set to ~A~&" self new-value))
;;; RUN/TEST FUNCTION
(defun run-entry-test () (test-window 'entry-test))
-----
The code assumes the value of the entry widget (what the user entered) is stored in md-value of the entry widget. I tried monkey style copying from the demos to no avail so far.
Hmmpf! What am I doing wrong ? Thx for any hints.
Frank