Hi,
I get an error if I try to use a :textvariable in a label:
(with-ltk () (let ((foo "")) (make-instance 'label :textvariable foo)))
Invalid initialization argument: :TEXTVARIABLE
In fact, when I expand the code to create a label class in ltk.lisp I see that there's no :textvariable key:
(defwidget label (tktextvariable widget) () "label")
And the textvariable that is being generated is text_<value of :text>.
Any chance this can be fixed in the next release?
Cheers,
Pedro
Hi Pedro,
can you tell me why you want to specify the name of the text variable for labels?
Regards, Peter
On Sat, Oct 31, 2009 at 6:25 AM, Pedro Kröger pedro.kroger@gmail.com wrote:
Hi,
I get an error if I try to use a :textvariable in a label:
(with-ltk () (let ((foo "")) (make-instance 'label :textvariable foo)))
Invalid initialization argument: :TEXTVARIABLE
In fact, when I expand the code to create a label class in ltk.lisp I see that there's no :textvariable key:
(defwidget label (tktextvariable widget) () "label")
And the textvariable that is being generated is text_<value of :text>.
Any chance this can be fixed in the next release?
Cheers,
Pedro
ltk-user site list ltk-user@common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
Peter Herth herth@peter-herth.de writes:
can you tell me why you want to specify the name of the text variable for labels?
to implement a statusbar and have the text change when necessary. Right now I'm using something like:
(defun statusbar-update (text) (format-wish "set text_statusbar { ~a}" text))
(defun statusbar-clean () (format-wish "set text_statusbar {}"))
Initially I thought I needed to pass a lisp variable to :textvariable and it'd be mapped to the variable in -textvariable. Is that the wrong way to approach it?
Pedro
To read and set the content of any tktextvariable descendant widget, you can use the "text" generic function. So if you have a label called lbl, you can read its current text with (text lbl) and change it with (setf (text lbl) "Hello World")
If you need to track content changes e.g. with the entry widget (which also inherits from tktextvariable), bind the "<KeyPress>" event, and you can read the new text contant also with the text function. Does this address all your needs?
Regards, Peter
Peter Herth herth@peter-herth.de writes:
Does this address all your needs?
Yes, it does, thanks. I don't know why I was trying to do it in such a convoluted way.
Pedro