Ignore:
Timestamp:
Mar 3, 2015 7:23:20 AM (6 years ago)
Author:
dkearney
Message:

merging vtkisosurface and gauge widget updates from uvv branch to trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/gui/scripts/gauge.tcl

    r3733 r5054  
    4242    itk_option define -sampleheight sampleHeight SampleHeight 0
    4343    itk_option define -log log Log ""
     44    itk_option define -validatecommand validateCommand ValidateCommand ""
    4445
    4546    constructor {args} { # defined below }
     
    236237            }
    237238            real {
    238                 # "scan" will reject the number if the string is "NaN" or
    239                 # "Inf" or the empty string.  It also is accepts large numbers
    240                 # (e.g. 111111111111111111111) that "string is double"
    241                 # rejects.  The problem with "scan" is that it doesn't care if
    242                 # there are extra characters trailing the number (eg. "123a").
    243                 # The extra %s substitution is used to detect this case.
     239                # "scan" will reject the number if the string is "NaN" or
     240                # "Inf" or the empty string.  It also is accepts large numbers
     241                # (e.g. 111111111111111111111) that "string is double"
     242                # rejects.  The problem with "scan" is that it doesn't care if
     243                # there are extra characters trailing the number (eg. "123a").
     244                # The extra %s substitution is used to detect this case.
    244245                if { [scan $nv "%g%s" dummy1 dummy2] != 1 } {
    245246                    error "bad value \"$nv\": should be a real number"
     
    288289                error "maximum value allowed here is $convMaxVal"
    289290            }
     291        }
     292
     293        #
     294        # If there's a -validatecommand option, then invoke the code
     295        # now to check the new value.
     296        #
     297        if {[string length $itk_option(-validatecommand)] > 0} {
     298            set cmd "uplevel #0 [list $itk_option(-validatecommand) [list $newval]]"
     299            set result [eval $cmd]
    290300        }
    291301
Note: See TracChangeset for help on using the changeset viewer.