diff options
Diffstat (limited to 'library/demos/button.tcl')
-rw-r--r-- | library/demos/button.tcl | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/library/demos/button.tcl b/library/demos/button.tcl index 896f72c..8211f4b 100644 --- a/library/demos/button.tcl +++ b/library/demos/button.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a toplevel window containing # several button widgets. # -# RCS: @(#) $Id: button.tcl,v 1.2 1998/09/14 18:23:27 stanton Exp $ +# RCS: @(#) $Id: button.tcl,v 1.3 2003/08/20 23:02:18 hobbs Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -19,18 +19,21 @@ positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "If you click on any of the four buttons below, the background of the button area will change to the color indicated in the button. You can press Tab to move among the buttons, then press Space to invoke the current button." pack $w.msg -side top -frame $w.buttons -pack $w.buttons -side bottom -fill x -pady 2m -button $w.buttons.dismiss -text Dismiss -command "destroy $w" -button $w.buttons.code -text "See Code" -command "showCode $w" -pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 +## See Code / Dismiss buttons +set btns [addSeeDismiss $w.buttons $w] +pack $btns -side bottom -fill x + +proc colorrefresh {w col} { + $w configure -bg $col + $w.buttons configure -bg $col +} button $w.b1 -text "Peach Puff" -width 10 \ - -command "$w config -bg PeachPuff1; $w.buttons config -bg PeachPuff1" + -command [list colorrefresh $w PeachPuff1] button $w.b2 -text "Light Blue" -width 10 \ - -command "$w config -bg LightBlue1; $w.buttons config -bg LightBlue1" + -command [list colorrefresh $w LightBlue1] button $w.b3 -text "Sea Green" -width 10 \ - -command "$w config -bg SeaGreen2; $w.buttons config -bg SeaGreen2" + -command [list colorrefresh $w SeaGreen2] button $w.b4 -text "Yellow" -width 10 \ - -command "$w config -bg Yellow1; $w.buttons config -bg Yellow1" + -command [list colorrefresh $w Yellow1] pack $w.b1 $w.b2 $w.b3 $w.b4 -side top -expand yes -pady 2 |