Has anyone a clue how postcommand in combobox is supposed to be used?
I want to construct the values of a combobox according to the state
of a device just when klicking on the widget.
I can construct a combobox:
(defun combo-1 ()
(ltk:with-ltk ()
(let ((c (make-instance 'combobox :text "Values:" :values '(1 2 3))))
(ltk:pack c :side :left :padx 2))))
and change the values outside the constructor:
(defun combo-values ()
"Change :values of combobox outside the constructor"
(ltk:with-ltk ()
(let ((c (make-instance 'combobox :text "Values:")))
(ltk:pack c :side :left :padx 2)
(setf (options c) '(1 2 3))))) ; changes field :values
Even if I think it would have been better if this would have worked instead:
(setf (values c) '(1 2 3))
But fail when I try to use postcommand. This doesn't work:
(defun combo-postcommand-1 ()
"Use of postcommand in combobox."
(ltk:with-ltk ()
(let ((c (make-instance 'combobox :text "Values:" :postcommand
(lambda () (set (options c) '(1 2 3))))))
(ltk:pack c :side :left :padx 2))))
(I understand that c is not defined when the lambda command is read but
don't see a correct solution.)
I can not even run a simple function as postcommand, because this
doesn't work either:
(defun combo-postcommand-2 ()
(ltk:with-ltk ()
(let ((c (make-instance 'combobox :text "Values:" :postcommand
(lambda () (format t "Run postcommand~%")))))
(ltk:pack c :side :left :padx 2))))
???