summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
authordas <das>2007-04-23 21:16:00 (GMT)
committerdas <das>2007-04-23 21:16:00 (GMT)
commit97873b5cca440eeaaf3787bc7d4fa5188b2510d3 (patch)
treed05530f9850fbb244956c2cdd80abfda3de610e3 /library/demos
parenteed9e6e51c9b315cca0fab5242fb5d5ed79f1d92 (diff)
downloadtk-97873b5cca440eeaaf3787bc7d4fa5188b2510d3.zip
tk-97873b5cca440eeaaf3787bc7d4fa5188b2510d3.tar.gz
tk-97873b5cca440eeaaf3787bc7d4fa5188b2510d3.tar.bz2
* library/demos/goldberg.tcl: fix overwriting of widget demo global.
* library/demos/menu.tcl: on aqua, use custom MDEF and tearoffs; * library/demos/menubu.tcl: correct menubutton toplevel name. * library/demos/puzzle.tcl: fix button size & padding for aqua. * library/demos/radio.tcl:
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/goldberg.tcl3
-rw-r--r--library/demos/menu.tcl15
-rw-r--r--library/demos/menubu.tcl14
-rw-r--r--library/demos/puzzle.tcl6
-rw-r--r--library/demos/radio.tcl6
5 files changed, 22 insertions, 22 deletions
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 97fed22..8daa73e 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -50,8 +50,7 @@ wm iconname $w "goldberg"
wm resizable $w 0 0
#positionWindow $w
-set font {Arial 10}
-label $w.msg -font $font -wraplength 4i -justify left -text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
+label $w.msg -font {Arial 10} -wraplength 4i -justify left -text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
pack $w.msg -side top
if 0 {
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index b9f98a3..d1b7c1c 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.10 2005/08/09 07:39:19 das Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.11 2007/04/23 21:16:00 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -19,9 +19,9 @@ wm iconname $w "menu"
positionWindow $w
label $w.msg -font $font -wraplength 4i -justify left
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
- $w.msg configure -text "This window contains a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by dragging outside of its bounds and releasing the mouse."
+if {[tk windowingsystem] eq "aqua"} {
+ catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}
+ $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
} else {
$w.msg configure -text "This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
}
@@ -56,8 +56,7 @@ set m $w.menu.basic
$w.menu add cascade -label "Basic" -menu $m -underline 0
menu $m -tearoff 0
$m add command -label "Long entry that does nothing"
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
+if {[tk windowingsystem] eq "aqua"} {
set modifier Command
} elseif {$tcl_platform(platform) == "windows"} {
set modifier Control
@@ -144,7 +143,7 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
set m $w.menu.colors
$w.menu add cascade -label "Colors" -menu $m -underline 1
-menu $m
+menu $m -tearoff 1
foreach i {red orange yellow green blue} {
$m add command -label $i -background $i -command [list \
puts "You invoked \"$i\"" ]
@@ -160,3 +159,5 @@ bind Menu <<MenuSelect>> {
set menustatus $label
update idletasks
}
+
+if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
diff --git a/library/demos/menubu.tcl b/library/demos/menubu.tcl
index e235fae..cec3284 100644
--- a/library/demos/menubu.tcl
+++ b/library/demos/menubu.tcl
@@ -1,9 +1,9 @@
-# menubutton.tcl --
+# menubu.tcl --
#
# This demonstration script creates a window with a bunch of menus
# and cascaded menus using menubuttons.
#
-# # RCS: @(#) $Id: menubu.tcl,v 1.5 2004/12/21 11:56:35 dkf Exp $
+# # RCS: @(#) $Id: menubu.tcl,v 1.6 2007/04/23 21:16:01 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -11,16 +11,16 @@ if {![info exists widgetDemo]} {
package require Tk
-set w .menubutton
+set w .menubu
catch {destroy $w}
toplevel $w
wm title $w "Menu Button Demonstration"
wm iconname $w "menubutton"
positionWindow $w
-
frame $w.body
pack $w.body -expand 1 -fill both
+if {[tk windowingsystem] eq "aqua"} {catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}}
menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised
menu $w.body.below.m -tearoff 0
@@ -57,8 +57,7 @@ pack $body.buttons -padx 25 -pady 25
tk_optionMenu $body.buttons.options menubuttonoptions one two three
pack $body.buttons.options -side left -padx 25 -pady 25
set m [tk_optionMenu $body.buttons.colors paletteColor Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet]
-if {[string equal [tk windowingsystem] "classic"]
- || [string equal [tk windowingsystem] "aqua"]} {
+if {[tk windowingsystem] eq "aqua"} {
set topBorderColor Black
set bottomBorderColor Black
} else {
@@ -90,5 +89,4 @@ foreach i {Black gray75 gray50 White} {
pack $body.buttons.colors -side left -padx 25 -pady 25
-
-
+if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
diff --git a/library/demos/puzzle.tcl b/library/demos/puzzle.tcl
index 8b1a888..485f69c 100644
--- a/library/demos/puzzle.tcl
+++ b/library/demos/puzzle.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a 15-puzzle game using a collection
# of buttons.
#
-# RCS: @(#) $Id: puzzle.tcl,v 1.6 2004/12/21 11:56:35 dkf Exp $
+# RCS: @(#) $Id: puzzle.tcl,v 1.7 2007/04/23 21:16:01 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -59,8 +59,8 @@ scrollbar $w.s
# using place which doesn't autosize, then we need to have a
# slightly larger frame here...
-if {[string equal [tk windowingsystem] aqua]} {
- set frameSize 160
+if {[tk windowingsystem] eq "aqua"} {
+ set frameSize 168
} else {
set frameSize 120
}
diff --git a/library/demos/radio.tcl b/library/demos/radio.tcl
index be8a0cc..28ea236 100644
--- a/library/demos/radio.tcl
+++ b/library/demos/radio.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a toplevel window containing
# several radiobutton widgets.
#
-# RCS: @(#) $Id: radio.tcl,v 1.7 2004/12/21 11:56:35 dkf Exp $
+# RCS: @(#) $Id: radio.tcl,v 1.8 2007/04/23 21:16:01 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -29,7 +29,9 @@ labelframe $w.mid -pady 2 -text "Color" -padx 2
labelframe $w.right -pady 2 -text "Alignment" -padx 2
button $w.tristate -text Tristate -command "set size multi; set color multi" \
-pady 2 -padx 2
-
+if {[tk windowingsystem] eq "aqua"} {
+ $w.tristate configure -padx 10
+}
grid $w.left -column 0 -row 1 -pady .5c -padx .5c -rowspan 2
grid $w.mid -column 1 -row 1 -pady .5c -padx .5c -rowspan 2
grid $w.right -column 2 -row 1 -pady .5c -padx .5c