Changeset 437 for trunk/gui/scripts/switch.tcl
- Timestamp:
- May 13, 2006, 1:13:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/switch.tcl
r115 r437 32 32 itk_option define -width width Width 0 33 33 itk_option define -height height Height 0 34 itk_option define -state state State "normal" 34 35 35 36 constructor {args} { # defined below } … … 109 110 110 111 bind $itk_component(value) <ButtonPress> \ 111 [ list $itk_component(presetlist) post $itk_component(vframe) left]112 [itcl::code $this _presets dropdown] 112 113 $itk_component(presets) configure -command \ 113 [ list $itk_component(presetlist) post $itk_component(vframe) left]114 [itcl::code $this _presets dropdown] 114 115 115 116 eval itk_initialize $args … … 277 278 # ---------------------------------------------------------------------- 278 279 itcl::body Rappture::Switch::_hilite {comp state} { 280 if {$itk_option(-state) == "disabled"} { 281 set state 0 ;# never hilite when disabled 282 } 279 283 if {$comp == "value"} { 280 284 if {$state} { … … 285 289 return 286 290 } 287 288 291 if {$state} { 289 292 $itk_component($comp) configure -relief solid … … 305 308 # ---------------------------------------------------------------------- 306 309 itcl::body Rappture::Switch::_presets {option} { 310 if {$itk_option(-state) != "normal"} { 311 return ;# disabled? then bail out! 312 } 307 313 switch -- $option { 314 dropdown { 315 $itk_component(presetlist) post $itk_component(vframe) left 316 } 308 317 post { 309 318 set i [$itk_component(presetlist) index $_value] … … 324 333 } 325 334 default { 326 error "bad option \"$option\": should be post, unpost, select"335 error "bad option \"$option\": should be dropdown, post, unpost, select" 327 336 } 328 337 } … … 359 368 _redraw 360 369 } 370 } 371 372 # ---------------------------------------------------------------------- 373 # CONFIGURATION OPTION: -state 374 # ---------------------------------------------------------------------- 375 itcl::configbody Rappture::Switch::state { 376 set valid {normal disabled} 377 if {[lsearch -exact $valid $itk_option(-state)] < 0} { 378 error "bad value \"$itk_option(-state)\": should be [join $valid {, }]" 379 } 380 $itk_component(value) configure -state $itk_option(-state) 381 $itk_component(presets) configure -state $itk_option(-state) 361 382 } 362 383
Note: See TracChangeset
for help on using the changeset viewer.