Handling User Input: Example
- Creating a TixControl widget that accepts % value:
tixControl .c -variable pcnt -value 100% \
-validatecmd Validate -command Cmd
proc Validate {v} {
regsub {%} $v ““ v
if [catch {set v [expr int($v)]%}] {
set v 100%
}
return $v
}
proc Cmd {v} {puts “you have selected $v”}