Ignore:
Timestamp:
Mar 3, 2015, 1:28:40 PM (10 years ago)
Author:
dkearney
Message:

merging vtk isosurface viewer and gauge widget changes for adjustable legend ranges feature from trunk to branch 1.3

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/gui/scripts/gauge.tcl

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