- Timestamp:
- Sep 2, 2008, 1:32:34 PM (16 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/booleanentry.tcl
r1076 r1135 123 123 set newval [lindex $args 0] 124 124 $itk_component(switch) value $newval 125 event generate $itk_component(hull) <<Value>> 125 126 return $newval 126 127 -
trunk/gui/scripts/sequenceresult.tcl
r997 r1135 212 212 } 213 213 lappend _dlist $dataobj 214 215 214 $_dispatcher event -idle !rebuild 216 215 } … … 289 288 # ---------------------------------------------------------------------- 290 289 itcl::body Rappture::SequenceResult::download {option args} { 290 if { ![winfo exists $itk_component(area).viewer] } { 291 return ""; # No data, no viewer, no download. 292 } 291 293 switch $option { 292 294 coming { 293 295 return [$itk_component(area).viewer download coming] 294 296 } 295 297 controls { … … 336 338 # ---------------------------------------------------------------------- 337 339 itcl::body Rappture::SequenceResult::play {} { 340 if { [llength $_indices] == 0 } { 341 return; # No frames (i.e. no data). 342 } 338 343 # cancel any existing animation 339 344 pause … … 477 482 } 478 483 default { 479 error "don't know how to view sequences of $type" 484 puts stderr "don't know how to view sequences of type \"$type\"" 485 puts stderr "Is the sequence empty?" 486 return 480 487 } 481 488 } -
trunk/gui/scripts/switch.tcl
r1120 r1135 3 3 # 4 4 # This widget is used to control a (boolean) on/off value. 5 # It is just a wrapper around a checkbutton.5 # It is just a wrapper around a button. 6 6 # ====================================================================== 7 7 # AUTHOR: Michael McLennan, Purdue University … … 22 22 public method value {args} 23 23 public method updateText {} 24 private method _toggle {args} 24 25 private variable _value 0 ;# value for this widget 25 26 } … … 34 35 itcl::body Rappture::Switch::constructor {args} { 35 36 36 itk_component add value { 37 checkbutton $itk_interior.value \ 38 -variable [itcl::scope _value] \ 39 -command [itcl::code $this updateText] 37 itk_component add button { 38 button $itk_interior.value \ 39 -compound left \ 40 -overrelief flat -relief flat -padx 3 -pady 0 -bd 0 \ 41 -command [itcl::code $this _toggle] 40 42 } { 41 43 #rename -background -textbackground textBackground Background 42 44 } 43 pack $itk_component( value) -side left -expand yes -fill both45 pack $itk_component(button) -side left -expand yes -fill both 44 46 eval itk_initialize $args 45 47 } … … 61 63 set args [lreplace $args $i $i] 62 64 } 63 64 65 if {[llength $args] == 1} { 65 66 set newval [lindex $args 0] … … 80 81 } 81 82 83 # ---------------------------------------------------------------------- 84 # _toggle 85 # 86 # Use internally to convert the toggled button into the 87 # proper boolean format. Yes, right now it's hardcoded to 88 # yes/no. But in the future it could be some other text. 89 # 90 # Can't use old "value" method because _value is already set 91 # be the widget and doesn't pass the value on the command line. 92 # 93 # ---------------------------------------------------------------------- 94 itcl::body Rappture::Switch::_toggle {} { 95 set _value [expr ($_value==0) ] 96 event generate $itk_component(hull) <<Value>> 97 updateText 98 } 99 82 100 itcl::body Rappture::Switch::updateText {} { 83 set mesg [expr {($_value) ? "on" : "off"}] 84 $itk_component(value) configure -text $mesg 101 if { $_value } { 102 $itk_component(button) configure -text "yes" \ 103 -image [Rappture::icon cbon] 104 } else { 105 $itk_component(button) configure -text "no" \ 106 -image [Rappture::icon cboff] 107 } 85 108 } 86 109 … … 90 113 # ---------------------------------------------------------------------- 91 114 itcl::configbody Rappture::Switch::oncolor { 92 $itk_component(value) configure -selectcolor $itk_option(-oncolor)115 #$itk_component(button) configure -selectcolor $itk_option(-oncolor) 93 116 } 94 117 … … 101 124 error "bad value \"$itk_option(-state)\": should be [join $valid {, }]" 102 125 } 103 $itk_component( value) configure -state $itk_option(-state)126 $itk_component(button) configure -state $itk_option(-state) 104 127 }
Note: See TracChangeset
for help on using the changeset viewer.