[ltk-user] Spinbox

Marco Gidde marco.gidde at tiscali.de
Wed Jan 25 09:53:38 UTC 2006


Peter Herth <herth at peter-herth.de> writes:

> 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.

Thanks for this patch. Except for a missing closing brace after the %s
in SPINBOX-COMMAND it works.

> But as the spinbox widget is derived from the tktextvariable class,
> you can always ask for (text spinbox)

I would have bet that a spinbox provides a number. Tk seems to be a
bit different from the toolkits I know. :-)


Regards,

Marco




More information about the ltk-user mailing list