Changeset 578 for trunk


Ignore:
Timestamp:
Feb 19, 2007, 11:07:33 AM (18 years ago)
Author:
dkearney
Message:

added code to normalize the units entered by the user

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/gauge.tcl

    r571 r578  
    219219        set units $itk_option(-units)
    220220        if {"" != $units} {
    221             set newval [Rappture::Units::convert $newval \
    222                 -context $units]
     221            set newval [Rappture::Units::convert $newval -context $units]
    223222            set nvUnits [Rappture::Units::Search::for $newval]
    224223            if { "" == $nvUnits} {
    225224                set msg [Rappture::Units::description $units]
    226                 error "Unrecognized units: $newval\nEnter value with units $msg"
     225                error "Unrecognized units: $newval\nEnter value with units of $msg"
    227226            }
    228227            set nv [Rappture::Units::convert $nv \
    229228                -context $units -to $units -units off]
     229
     230            # Normalize the units name
     231            set newval [Rappture::Units::convert $newval -units off]$nvUnits
    230232        }
    231233
     
    245247        if {"" != $itk_option(-minvalue)} {
    246248            set convMinVal [set minv $itk_option(-minvalue)]
    247             if {$units != ""} {
     249            if {"" != $units} {
    248250                set minv [Rappture::Units::convert $minv \
    249251                    -context $units -to $units -units off]
     
    266268        if {"" != $itk_option(-maxvalue)} {
    267269            set convMaxVal [set maxv $itk_option(-maxvalue)]
    268             if {$units != ""} {
     270            if {"" != $units} {
    269271                set maxv [Rappture::Units::convert $maxv \
    270272                    -context $units -to $units -units off]
     
    288290            return
    289291        }
     292
    290293        set _value $newval
     294
    291295        _redraw
    292296        event generate $itk_component(hull) <<Value>>
Note: See TracChangeset for help on using the changeset viewer.