Hi,
When running the following LTK code, I'd expect the text of the label
to
change when I press the "Change" button, but that does not happen,
althouth the "Reconfigured label" message does get printed. Also,
with *debug-tk* set, I do see a "configure" command for the label
being sent to wish, but with no apparent effect.
Analogous Tcl code run under wish works as expected. I am running
this code in CLISP under Cygwin.
(defun test-configure ()
(with-ltk ()
(let* ((lbl (make-instance 'label :master nil :text "Hello"))
(btn (make-instance 'button :text "Change" :master nil
:command
(lambda ()
(configure lbl :text "Goodbye")
(format t "Reconfigured label.~&")))))
(grid btn 0 0)
(grid lbl 0 1))))
(test-configure)
Is there anything wrong with this code? Or do I misunderstand
how LTK works?
Thanks,
-- JK
·······@kneuro.net wrote:
> Hi,
>
> When running the following LTK code, I'd expect the text of the label
> to
> change when I press the "Change" button, but that does not happen,
> althouth the "Reconfigured label" message does get printed. Also,
> with *debug-tk* set, I do see a "configure" command for the label
> being sent to wish, but with no apparent effect.
>
> Analogous Tcl code run under wish works as expected. I am running
> this code in CLISP under Cygwin.
>
> (defun test-configure ()
> (with-ltk ()
> (let* ((lbl (make-instance 'label :master nil :text "Hello"))
> (btn (make-instance 'button :text "Change" :master nil
> :command
>
> (lambda ()
>
> (configure lbl :text "Goodbye")
>
> (format t "Reconfigured label.~&")))))
> (grid btn 0 0)
> (grid lbl 0 1))))
> (test-configure)
>
> Is there anything wrong with this code? Or do I misunderstand
> how LTK works?
Here is a wild guess: try (setf (text lbl) "Goodbye")
i think Ltk tries to hide TK configure behind slot accessors, and you
may have left out some necessary internal wiring by going directly at it.
But I really am just guessing. Have you tried the LTk list itself?
kt
Ken Tilton wrote:
> ·······@kneuro.net wrote:
> > Hi,
> >
> > When running the following LTK code, I'd expect the text of the label
> > to
> > change when I press the "Change" button, but that does not happen,
[snip]
> Here is a wild guess: try (setf (text lbl) "Goodbye")
That works. I actually did try it earlier, but must have done
some basic thing wrong, since that time it gave me an error
indicating that setf was not applicable. Probably I
said (setf (text lbl) :text "Goodbye"), bonehead that I
am sometimes...
> i think Ltk tries to hide TK configure behind slot accessors, and you
> may have left out some necessary internal wiring by going directly at it.
>
> But I really am just guessing. Have you tried the LTk list itself?
I trolled their archives, but didn't post a query. Anyway, thanks
very much.
-- JK