On 1/24/06, Marco Gidde marco.gidde@tiscali.de wrote:
Hi,
the command associated with a SPINBOX irritates me a little bit. When I give a function via the :COMMAND key in MAKE-INSTANCE it has to be a function without arguments, which rises the question, how can I get the value (the VALUE method is not specialized for SPINBOXes). On the other hand (SETF COMMAND) expects a function of one argument and this argument is the value I'm looking for (as a string).
Since I don't know anything about a equivalent tcl/tk program I have to ask: is it a bug, a feature and/or a misconception of me?
Yes, this is a bug which came up with the creation of the defwidget macro. As the command initarg should be a different one than the "normal" one, we have to create a new definition for the spinbox: (spinbox-command command "~@[ -command {callbackstring ~a %s~]" (and command
(progn
(add-callback (name widget) command)
(name widget)))) this goes about line 786. And then change line 1018 and following to: (defargs spinbox () activebackground background borderwidth Button.background Button.cursor Button.relief spinbox-command cursor disabledbackground disabledforeground exportselection font foreground format from highlightbackground highlightcolor highlightthickness increment insertbackground insertborderwidth insertofftime insertontime insertwidth invalidcommand justify relief readonlybackground repeatdelay repeatinterval selectbackground selectborderwidth selectforeground state takefocus textvariable to validate validatecommand values width wrap xscrollcommand) So it uses the spinbox-command definition instead of the plain command definition. But as the spinbox widget is derived from the tktextvariable class, you can always ask for (text spinbox)
Peter