summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2020-11-20 17:27:31 (GMT)
committermarc_culler <marc.culler@gmail.com>2020-11-20 17:27:31 (GMT)
commit668ebaa67fe5da07f034c1ac75d49f95cafdfad8 (patch)
tree5f7b29a4efe116d93d708deeca41fbff3159d9e7 /library/demos
parentd9fbd95e5a092d76fbaa56f23947cfb01dd260e8 (diff)
parent14ad08440d4685add2fb7ba440f4ab828153c5e8 (diff)
downloadtk-668ebaa67fe5da07f034c1ac75d49f95cafdfad8.zip
tk-668ebaa67fe5da07f034c1ac75d49f95cafdfad8.tar.gz
tk-668ebaa67fe5da07f034c1ac75d49f95cafdfad8.tar.bz2
Aqua - Fix [635167af14] and [cc7e0dfc8a]: artifacts and exceptions caused by unitialized pixel values; attempt to rationalize and document menu color options; adjust timing of menu initialization.
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/menu.tcl21
1 files changed, 18 insertions, 3 deletions
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index 6989523..62991f3 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -144,9 +144,24 @@ $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 -tearoff 1
-foreach i {red orange yellow green blue} {
- $m add command -label $i -background $i -command [list \
- puts "You invoked \"$i\"" ]
+if {[tk windowingsystem] eq "aqua"} {
+ # Aqua ignores the -background and -foreground options, but a compound
+ # button can be used for selecting colors.
+ foreach i {red orange yellow green blue} {
+ image create photo image_$i -height 16 -width 16
+ image_$i put black -to 0 0 16 1
+ image_$i put black -to 0 1 1 16
+ image_$i put black -to 0 15 16 16
+ image_$i put black -to 15 1 16 16
+ image_$i put $i -to 1 1 15 15
+ $m add command -label $i -image image_$i -compound left -command [list \
+ puts "You invoked \"$i\"" ]
+ }
+} else {
+ foreach i {red orange yellow green blue} {
+ $m add command -label $i -background $i -command [list \
+ puts "You invoked \"$i\"" ]
+ }
}
$w configure -menu $w.menu