- Timestamp:
- Nov 5, 2008, 12:15:09 PM (16 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/controlOwner.tcl
r1159 r1207 40 40 private variable _path2widget ;# maps path => widget on this page 41 41 private variable _owner2paths ;# for notify: maps owner => interests 42 private variable _type2curpath ;# maps type(path) => path's current value 42 43 private variable _callbacks ;# for notify: maps owner/path => callback 43 44 private variable _dependencies ;# maps path => other paths dep on this 44 45 } 45 46 46 47 # ---------------------------------------------------------------------- 47 48 # CONSTRUCTOR … … 53 54 set _path [lindex $parts 1] 54 55 $_owner _slave add $this 56 } 57 58 # we are adding this so notes can be used 59 # in coordination with loaders inside the load function 60 array set _type2curpath { 61 choice current 62 boolean current 63 image current 64 integer current 65 loader current 66 note contents 67 number current 68 string current 55 69 } 56 70 } … … 248 262 # the following elements do not accept "current" tags, skip them 249 263 set type [[tool] xml element -as type $path] 250 if {[lsearch {group separator control note} $type] >= 0} {264 if {[lsearch {group separator control} $type] >= 0} { 251 265 continue 252 266 } 253 267 268 set type [[tool] xml element -as type $path] 269 if {[info exists _type2curpath($type)]} { 270 set currentpath $path.$_type2curpath($type) 271 } else { 272 # default incase i forgot an inpuit type in _type2curpath 273 set currentpath $path.current 274 } 275 254 276 # copy new value to the XML tree 255 [tool] xml copy $ path.current from $newobj $path.current277 [tool] xml copy $currentpath from $newobj $currentpath 256 278 257 279 # also copy to the widget associated with the tree 258 if {"" != [$newobj element -as type $path .current]} {259 set val [$newobj get $ path.current]280 if {"" != [$newobj element -as type $path]} { 281 set val [$newobj get $currentpath] 260 282 if {[string length $val] > 0 261 || [llength [$newobj children $ path.current]] == 0} {283 || [llength [$newobj children $currentpath]] == 0} { 262 284 $_path2widget($path) value $val 263 285 } else { 264 set obj [$newobj element -as object $ path.current]286 set obj [$newobj element -as object $currentpath] 265 287 $_path2widget($path) value $obj 266 288 } -
trunk/gui/scripts/note.tcl
r785 r1207 80 80 # ---------------------------------------------------------------------- 81 81 itcl::body Rappture::Note::value {args} { 82 error "can't set value" 82 set onlycheck 0 83 set i [lsearch -exact $args -check] 84 if {$i >= 0} { 85 set onlycheck 1 86 set args [lreplace $args $i $i] 87 } 88 89 if {[llength $args] == 1} { 90 if {$onlycheck} { 91 # someday we may add validation... 92 return 93 } 94 set newval [lindex $args 0] 95 _setContents $newval 96 return $newval 97 98 } elseif {[llength $args] != 0} { 99 error "wrong # args: should be \"value ?-check? ?newval?\"" 100 } 101 102 # 103 # Query the value and return. 104 # 105 error "don't know how to check value of <note>" 106 return 83 107 } 84 108
Note: See TracChangeset
for help on using the changeset viewer.