aboutsummaryrefslogtreecommitdiff
path: root/demos/allOptions.tcl
diff options
context:
space:
mode:
authorlecoanet2003-04-16 09:43:32 +0000
committerlecoanet2003-04-16 09:43:32 +0000
commiteed2656db0adae2c234c3d74af0913746ed5c444 (patch)
treef2821633165f1caf635a7e77708aeda998786c10 /demos/allOptions.tcl
parentc0dc6e04d97b53185eda9bbd68900eba15ae1f84 (diff)
downloadtkzinc-eed2656db0adae2c234c3d74af0913746ed5c444.zip
tkzinc-eed2656db0adae2c234c3d74af0913746ed5c444.tar.gz
tkzinc-eed2656db0adae2c234c3d74af0913746ed5c444.tar.bz2
tkzinc-eed2656db0adae2c234c3d74af0913746ed5c444.tar.xz
Many updates for the 3.2.90 release and new demos
Diffstat (limited to 'demos/allOptions.tcl')
-rw-r--r--demos/allOptions.tcl46
1 files changed, 24 insertions, 22 deletions
diff --git a/demos/allOptions.tcl b/demos/allOptions.tcl
index e4454fe..0e66b2d 100644
--- a/demos/allOptions.tcl
+++ b/demos/allOptions.tcl
@@ -18,17 +18,19 @@ button $w.buttons.code -text "See Code" -command "showCode $w"
pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
# The explanation displayed when running this demo
-label $w.label -text "Click on one of the following\nbuttons to get a list of Item\nattributes (or zinc options)\nwith their types.\n" -justify "left"
+label $w.label -justify left -text {Click on one of the following
+buttons to get a list of Item
+attributes (or zinc options)
+with their types.}
pack $w.label -padx 10 -pady 10
# Creating the zinc widget
-zinc $w.zinc -width 1 -height 1 -font "10x20" -borderwidth 0 -relief "sunken"
+zinc $w.zinc -width 1 -height 1 -font 10x20 -borderwidth 0 -relief sunken
pack $w.zinc
# Creating an instance of every item type
-#my %itemtypes;
# These Items have fields! So the number of fields must be given at creation time
foreach type {tabular track waypoint} {
@@ -43,12 +45,12 @@ foreach type {group icon map reticle text window} {
# These items needs some coordinates at creation time
# However curves usually needs more than 2 points.
foreach type {arc curve rectangle} {
- set itemtypes($type) [$w.zinc add $type 1 "0 0 1 1"]
+ set itemtypes($type) [$w.zinc add $type 1 {0 0 1 1}]
}
# Triangles item needs at least 3 points for the coordinates
foreach type {triangles} {
- set itemtypes($type) [$w.zinc add $type 1 "0 0 1 1 2 2"]
+ set itemtypes($type) [$w.zinc add $type 1 {0 0 1 1 2 2}]
}
@@ -56,28 +58,28 @@ proc showAllOptions { w type} {
global itemtypes
if [winfo exists .tl] {destroy .tl}
toplevel .tl
- set title "All options of an item $type"
- #my @option return
- if {[string compare $type "zinc"]==0} {
+ if {[string compare $type zinc]==0} {
set options [$w.zinc configure]
- set typeopt "optionClass"
- set readopt "defaultValue"
- set title "All options of zinc widget"
+ set typeopt optionClass
+ set readopt defaultValue
+ set readoff 3
+ set title {All options of zinc widget}
} else {
set options [$w.zinc itemconfigure $itemtypes($type)];
- set title "All attributes of an item $type"
- set typeopt "Type"
- set readopt "ReadOnly"
+ set title "All attributes of an $type item"
+ set typeopt Type
+ set readopt ReadOnly
+ set readoff 2
}
- #.tl configure -title $title
+ wm title .tl $title
frame .tl.f1
- set bgcolor "ivory"
+ set bgcolor ivory
- label .tl.f1.opt -text "Option" -background $bgcolor -relief "ridge" -width 20
- label .tl.f1.typ -text $typeopt -background $bgcolor -relief "ridge" -width 20
- label .tl.f1.rd -text $readopt -background $bgcolor -relief "ridge" -width 21
+ label .tl.f1.opt -text Option -background $bgcolor -relief ridge -width 20
+ label .tl.f1.typ -text $typeopt -background $bgcolor -relief ridge -width 20
+ label .tl.f1.rd -text $readopt -background $bgcolor -relief ridge -width 21
pack .tl.f1.opt .tl.f1.typ .tl.f1.rd -side left
set nbelem [llength $options]
@@ -86,13 +88,13 @@ proc showAllOptions { w type} {
listbox .tl.f2.l2 -width 20 -height $nbelem
listbox .tl.f2.l3 -width 20 -height $nbelem
pack .tl.f2.l1 .tl.f2.l2 .tl.f2.l3 -side left
- pack .tl.f1 .tl.f2 -side top -anchor "nw"
+ pack .tl.f1 .tl.f2 -side top -anchor nw
# Remplissage des list box
foreach elem $options {
.tl.f2.l1 insert end [lindex $elem 0]
.tl.f2.l2 insert end [lindex $elem 1]
- .tl.f2.l3 insert end [lindex $elem 3]
+ .tl.f2.l3 insert end [lindex $elem $readoff]
}
}
@@ -106,7 +108,7 @@ foreach type [lsort [array names itemtypes]] {
}
foreach type [lsort [array names itemtypes]] {
- button $w.col.$type -text "$type" -width $width -command {showAllOptions $w $type}
+ button $w.col.$type -text "$type" -width $width -command "showAllOptions $w $type"
pack $w.col.$type -pady 4
}