Skip to content

Commit

Permalink
* library/demos/goldberg.tcl: fix overwriting of widget demo global.
Browse files Browse the repository at this point in the history
	* 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:
  • Loading branch information
das committed Apr 23, 2007
1 parent 83e0003 commit 6f1c8c5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
3 changes: 1 addition & 2 deletions library/demos/goldberg.tcl
Expand Up @@ -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 {
Expand Down
15 changes: 8 additions & 7 deletions library/demos/menu.tcl
Expand Up @@ -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."
Expand All @@ -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."
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\"" ]
Expand All @@ -160,3 +159,5 @@ bind Menu <<MenuSelect>> {
set menustatus $label
update idletasks
}

if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
14 changes: 6 additions & 8 deletions library/demos/menubu.tcl
@@ -1,26 +1,26 @@
# 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."
}

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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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}}
6 changes: 3 additions & 3 deletions library/demos/puzzle.tcl
Expand Up @@ -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."
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 4 additions & 2 deletions library/demos/radio.tcl
Expand Up @@ -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."
Expand All @@ -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
Expand Down

0 comments on commit 6f1c8c5

Please sign in to comment.