Changeset 22 for trunk/gui/scripts/numberentry.tcl
- Timestamp:
- Jul 16, 2005, 2:31:32 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/numberentry.tcl
r11 r22 14 14 inherit itk::Widget 15 15 16 constructor { xmlobjpath args} { # defined below }16 constructor {owner path args} { # defined below } 17 17 18 18 public method value {args} … … 23 23 protected method _newValue {} 24 24 25 private variable _ xmlobj "" ;# XML containing description25 private variable _owner "" ;# thing managing this control 26 26 private variable _path "" ;# path in XML to this number 27 27 } … … 37 37 # CONSTRUCTOR 38 38 # ---------------------------------------------------------------------- 39 itcl::body Rappture::NumberEntry::constructor { xmlobjpath args} {40 if { ![Rappture::library isvalid $xmlobj]} {41 error "bad value \"$xmlobj\": should be Rappture::library"42 } 43 set _ xmlobj $xmlobj39 itcl::body Rappture::NumberEntry::constructor {owner path args} { 40 if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} { 41 error "bad object \"$owner\": should be Rappture::ControlOwner" 42 } 43 set _owner $owner 44 44 set _path $path 45 45 … … 48 48 # 49 49 set presets "" 50 foreach pre [$ xmlobjchildren -type preset $path] {50 foreach pre [$_owner xml children -type preset $path] { 51 51 lappend presets \ 52 [$ xmlobjget $path.$pre.value] \53 [$ xmlobjget $path.$pre.label]52 [$_owner xml get $path.$pre.value] \ 53 [$_owner xml get $path.$pre.label] 54 54 } 55 55 56 56 set class Rappture::Gauge 57 set units [$ xmlobjget $path.units]57 set units [$_owner xml get $path.units] 58 58 if {$units != ""} { 59 59 set desc [Rappture::Units::description $units] … … 73 73 bind $itk_component(gauge) <<Value>> [itcl::code $this _newValue] 74 74 75 set min [$ xmlobjget $path.min]75 set min [$_owner xml get $path.min] 76 76 if {"" != $min} { $itk_component(gauge) configure -minvalue $min } 77 77 78 set max [$ xmlobjget $path.max]78 set max [$_owner xml get $path.max] 79 79 if {"" != $max} { $itk_component(gauge) configure -maxvalue $max } 80 80 81 81 if {$class == "Rappture::Gauge" && "" != $min && "" != $max} { 82 set color [$ xmlobjget $path.color]82 set color [$_owner xml get $path.color] 83 83 if {$color == ""} { 84 84 set color blue … … 94 94 95 95 # if the control has an icon, plug it in 96 set str [$ xmlobjget $path.about.icon]96 set str [$_owner xml get $path.about.icon] 97 97 if {$str != ""} { 98 98 $itk_component(gauge) configure -image [image create photo -data $str] … … 104 104 # Assign the default value to this widget, if there is one. 105 105 # 106 set str [$ xmlobjget $path.default]106 set str [$_owner xml get $path.default] 107 107 if {"" != $str != ""} { $itk_component(gauge) value $str } 108 108 } … … 151 151 # ---------------------------------------------------------------------- 152 152 itcl::body Rappture::NumberEntry::label {} { 153 set label [$_ xmlobjget $_path.about.label]153 set label [$_owner xml get $_path.about.label] 154 154 if {"" == $label} { 155 155 set label "Number" … … 167 167 # ---------------------------------------------------------------------- 168 168 itcl::body Rappture::NumberEntry::tooltip {} { 169 set str [$_ xmlobjget $_path.about.description]170 171 set units [$_ xmlobjget $_path.units]172 set min [$_ xmlobjget $_path.min]173 set max [$_ xmlobjget $_path.max]169 set str [$_owner xml get $_path.about.description] 170 171 set units [$_owner xml get $_path.units] 172 set min [$_owner xml get $_path.min] 173 set max [$_owner xml get $_path.max] 174 174 175 175 if {$units != "" || $min != "" || $max != ""} {
Note: See TracChangeset
for help on using the changeset viewer.