For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2007 > Spinbox and -validatecommand









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Spinbox and -validatecommand
Plebeian

2007-11-27, 4:33 am

Hi,

I am using ActiveTcl 8.4.12 on Windows 2k3 and I would like to make
the spinbox, disregard all keys except for 0-9, for insertion
purposes.

However, the code that I have, which DOES work for the entry widgets,
is not working for the spinbox. Here's my -validatecommand code.
Clearly I am , since if this works for the entry widgets, it
should work for the spinbox widget.


proc filterKeys {args} {

# Set the default value
set returnValue 0

if {[string is integer $args] == 1} {set returnValue 1}

return $returnValue
}
Pascal

2007-11-27, 4:33 am

Plebeian a écrit :
> Hi,
>
> I am using ActiveTcl 8.4.12 on Windows 2k3 and I would like to make
> the spinbox, disregard all keys except for 0-9, for insertion
> purposes.
>
> However, the code that I have, which DOES work for the entry widgets,
> is not working for the spinbox. Here's my -validatecommand code.
> Clearly I am , since if this works for the entry widgets, it
> should work for the spinbox widget.
>
>
> proc filterKeys {args} {
>
> # Set the default value
> set returnValue 0
>
> if {[string is integer $args] == 1} {set returnValue 1}
>
> return $returnValue
> }


I can't answer your question but why not using things like that :

spinbox $w.ftime.spW1 -from 1 -to 120 -increment 1 -validate all -vcmd {
regexp {^[0-9]+$} %P }

Pascal
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com