Changeset 5029 for branches/uq/gui/scripts/numberentry.tcl
- Timestamp:
- Feb 17, 2015 5:49:36 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq/gui/scripts/numberentry.tcl
r3647 r5029 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: NumberEntry - widget for entering numeric values … … 25 25 public method label {} 26 26 public method tooltip {} 27 28 27 protected method _newValue {} 29 28 … … 43 42 # ---------------------------------------------------------------------- 44 43 itcl::body Rappture::NumberEntry::constructor {owner path args} { 44 puts "NumberEntry '$path' '$args'" 45 set varname [lindex [split $path ()] 1] 46 45 47 if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} { 46 48 error "bad object \"$owner\": should be Rappture::ControlOwner" … … 48 50 set _owner $owner 49 51 set _path $path 50 52 53 puts "LABEL=[label]" 51 54 # 52 55 # Figure out what sort of control to create … … 58 61 lappend presets $value $label 59 62 } 60 63 61 64 set class Rappture::Gauge 62 65 set units [string trim [$_owner xml get $path.units]] 66 puts "units=$units" 63 67 if {$units != ""} { 64 68 set desc [Rappture::Units::description $units] … … 67 71 } 68 72 } 69 73 70 74 # 71 75 # Create the widget and configure it properly based on other … … 73 77 # 74 78 itk_component add gauge { 75 $class $itk_interior.gauge -units $units -presets $presets -log $path 79 $class $itk_interior.gauge -units $units -presets $presets -log $path -varname $varname -label [label] 76 80 } 77 81 pack $itk_component(gauge) -expand yes -fill both 78 82 bind $itk_component(gauge) <<Value>> [itcl::code $this _newValue] 79 83 80 84 set min [string trim [$_owner xml get $path.min]] 81 if {$min ne ""} { 82 $itk_component(gauge) configure -minvalue $min 83 } 84 85 if {$min ne ""} { 86 $itk_component(gauge) configure -minvalue $min 87 } 88 85 89 set max [string trim [$_owner xml get $path.max]] 86 if {$max ne ""} { 87 $itk_component(gauge) configure -maxvalue $max 90 if {$max ne ""} { 91 $itk_component(gauge) configure -maxvalue $max 88 92 } 89 93 … … 119 123 # 120 124 set str [string trim [$_owner xml get $path.default]] 121 if {$str ne ""} { 122 $itk_component(gauge) value $str 125 puts "Default=$str" 126 if {$str ne ""} { 127 $itk_component(gauge) value $str 123 128 } 124 129 }
Note: See TracChangeset
for help on using the changeset viewer.