Changeset 1120 for trunk/gui/scripts/switch.tcl
- Timestamp:
- Aug 19, 2008 9:36:54 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/switch.tcl
r1076 r1120 16 16 inherit itk::Widget 17 17 18 itk_option define -oncolor onColor Color " green"18 itk_option define -oncolor onColor Color "#00cc00" 19 19 itk_option define -state state State "normal" 20 20 21 21 constructor {args} { # defined below } 22 22 public method value {args} 23 public method updateText {} 23 24 private variable _value 0 ;# value for this widget 24 25 } … … 34 35 35 36 itk_component add value { 36 checkbutton $itk_interior.value -variable [itcl::scope _value] 37 checkbutton $itk_interior.value \ 38 -variable [itcl::scope _value] \ 39 -command [itcl::code $this updateText] 37 40 } { 38 rename -background -textbackground textBackground Background41 #rename -background -textbackground textBackground Background 39 42 } 40 43 pack $itk_component(value) -side left -expand yes -fill both … … 70 73 set _value $newval 71 74 event generate $itk_component(hull) <<Value>> 72 75 updateText 73 76 } elseif {[llength $args] != 0} { 74 77 error "wrong # args: should be \"value ?-check? ?newval?\"" … … 77 80 } 78 81 82 itcl::body Rappture::Switch::updateText {} { 83 set mesg [expr {($_value) ? "on" : "off"}] 84 $itk_component(value) configure -text $mesg 85 } 86 79 87 80 88 # ----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.