Changeset 193 for trunk/gui/scripts/controlOwner.tcl
- Timestamp:
- Feb 19, 2006 8:10:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/controlOwner.tcl
r115 r193 23 23 public method load {newobj} 24 24 public method widgetfor {path args} 25 public method valuefor {path args} 25 26 public method changed {path} 26 27 public method notify {option owner args} … … 84 85 } else { 85 86 unset _path2widget($path) 87 } 88 } 89 90 # ---------------------------------------------------------------------- 91 # USAGE: valuefor <path> ?<newValue>? 92 # 93 # Used by embedded widgets such as a Loader to query or set the 94 # value of another control. With no extra args, it returns the 95 # value of the widget at the <path> in the XML. Otherwise, it 96 # sets the value of the widget to <newValue>. 97 # ---------------------------------------------------------------------- 98 itcl::body Rappture::ControlOwner::valuefor {path args} { 99 # if this is a query operation, then look for the path 100 if {[llength $args] == 0} { 101 if {[info exists _path2widget($path)]} { 102 return [$_path2widget($path) value] 103 } 104 return "" 105 } 106 107 # otherwise, set the value 108 if {[llength $args] > 1} { 109 error "wrong # args: should be \"valuefor path ?newValue?\"" 110 } 111 112 if {[info exists _path2widget($path)]} { 113 $_path2widget($path) value [lindex $args 0] 114 } else { 115 error "bad path \"$path\": should be one of [join [lsort [array names _path2widget]] {, }]" 86 116 } 87 117 }
Note: See TracChangeset
for help on using the changeset viewer.