summaryrefslogtreecommitdiffstats
path: root/library/demos/ruler.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/demos/ruler.tcl')
-rw-r--r--library/demos/ruler.tcl16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl
index ccdb1fc..557b680 100644
--- a/library/demos/ruler.tcl
+++ b/library/demos/ruler.tcl
@@ -7,6 +7,8 @@ if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
+package require Tk
+
# rulerMkTab --
# This procedure creates a new triangular polygon in a canvas to
# represent a tab stop.
@@ -22,7 +24,6 @@ proc rulerMkTab {c x y} {
}
set w .ruler
-global tk_library
catch {destroy $w}
toplevel $w
wm title $w "Ruler Demonstration"
@@ -33,11 +34,9 @@ set c $w.c
label $w.msg -font $font -wraplength 5i -justify left -text "This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."
pack $w.msg -side top
-frame $w.buttons
-pack $w.buttons -side bottom -fill x -pady 2m
-button $w.buttons.dismiss -text Dismiss -command "destroy $w"
-button $w.buttons.code -text "See Code" -command "showCode $w"
-pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
+## See Code / Dismiss buttons
+set btns [addSeeDismiss $w.buttons $w]
+pack $btns -side bottom -fill x
canvas $c -width 14.8c -height 2.5c
pack $w.c -side top -fill x
@@ -49,14 +48,15 @@ set demo_rulerInfo(top) [winfo fpixels $c 1c]
set demo_rulerInfo(bottom) [winfo fpixels $c 1.5c]
set demo_rulerInfo(size) [winfo fpixels $c .2c]
set demo_rulerInfo(normalStyle) "-fill black"
+# Main widget program sets variable tk_demoDirectory
if {[winfo depth $c] > 1} {
set demo_rulerInfo(activeStyle) "-fill red -stipple {}"
set demo_rulerInfo(deleteStyle) [list -fill red \
- -stipple @[file join $tk_library demos images gray25.bmp]]
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
} else {
set demo_rulerInfo(activeStyle) "-fill black -stipple {}"
set demo_rulerInfo(deleteStyle) [list -fill black \
- -stipple @[file join $tk_library demos images gray25.bmp]]
+ -stipple @[file join $tk_demoDirectory images gray25.xbm]]
}
$c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1