diff options
author | dkf <dkf@noemail.net> | 2005-01-18 11:56:55 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2005-01-18 11:56:55 (GMT) |
commit | eb226a72fa3e801ce791eb924360c4de6e9f2c33 (patch) | |
tree | 6de111b0e12801f609f8c8457ff0d5cee0d77c14 /library/demos/menu.tcl | |
parent | 82443763b64d193d84bf08c038c8b1f4269d7cad (diff) | |
download | tk-eb226a72fa3e801ce791eb924360c4de6e9f2c33.zip tk-eb226a72fa3e801ce791eb924360c4de6e9f2c33.tar.gz tk-eb226a72fa3e801ce791eb924360c4de6e9f2c33.tar.bz2 |
Fixed dialog parenting problem described by Keith Nash. Also tidied up callbacks
FossilOrigin-Name: f936eea21b6a4827861f6c0e541e3bb34f5cabd6
Diffstat (limited to 'library/demos/menu.tcl')
-rw-r--r-- | library/demos/menu.tcl | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index 55bee0e..247b2d1 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubars. # -# RCS: @(#) $Id: menu.tcl,v 1.8 2004/12/21 11:56:35 dkf Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.9 2005/01/18 11:56:57 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -117,14 +117,15 @@ set m $w.menu.icon $w.menu add cascade -label "Icons" -menu $m -underline 0 menu $m -tearoff 0 # Main widget program sets variable tk_demoDirectory -$m add command \ - -bitmap @[file join $tk_demoDirectory images pattern.xbm] \ - -hidemargin 1 \ - -command { - tk_dialog .pattern {Bitmap Menu Entry} {The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.} {} 0 OK -} +$m add command -bitmap @[file join $tk_demoDirectory images pattern.xbm] \ + -hidemargin 1 -command [list \ + tk_dialog $w.pattern {Bitmap Menu Entry} \ + "The menu entry you invoked displays a bitmap rather than\ + a text string. Other than this, it is just like any other\ + menu entry." {} 0 OK ] foreach i {info questhead error} { - $m add command -bitmap $i -command "puts {You invoked the $i bitmap}" -hidemargin 1 + $m add command -bitmap $i -hidemargin 1 -command [list \ + puts "You invoked the $i bitmap" ] } $m entryconfigure 2 -columnbreak 1 @@ -134,19 +135,20 @@ menu $m -tearoff 0 foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Make life meaningful}} { $m add command -label $i -command [list puts "You invoked \"$i\""] } -$m entryconfigure "Does almost nothing" \ - -bitmap questhead -compound left -command { - tk_dialog .compound {Compound Menu Entry} {The menu entry you invoked\ - displays both a bitmap and a text string. Other than this, it\ - is just like any other menu entry.} {} 0 OK +$m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ + -command [list \ + tk_dialog $w.compound {Compound Menu Entry} \ + "The menu entry you invoked displays both a bitmap and a\ + text string. Other than this, it is just like any other\ + menu entry." {} 0 OK ] } set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m foreach i {red orange yellow green blue} { - $m add command -label $i -background $i \ - -command [list puts "You invoked \"$i\""] + $m add command -label $i -background $i -command [list \ + puts "You invoked \"$i\"" ] } $w configure -menu $w.menu |