diff options
Diffstat (limited to 'library/demos/widget')
-rw-r--r-- | library/demos/widget | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/library/demos/widget b/library/demos/widget index 0b538f3..65bdb4c 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -11,14 +11,15 @@ exec wish "$0" "$@" # ".tcl" files is this directory, which are sourced by this script # as needed. # -# RCS: @(#) $Id: widget,v 1.17 2003/09/30 14:54:30 dkf Exp $ +# RCS: @(#) $Id: widget,v 1.18 2003/11/03 15:30:45 dkf Exp $ package require Tcl 8.4 package require Tk 8.4 package require msgcat eval destroy [winfo child .] -::msgcat::mcload [file join $tk_library demos] +set tk_demoDirectory [file join [pwd] [file dirname [info script]]] +::msgcat::mcload $tk_demoDirectory namespace import ::msgcat::mc wm title . [mc "Widget Demonstration"] if {[tk windowingsystem] eq "x11"} { @@ -390,7 +391,7 @@ proc showVars {w args} { # index - The index of the character that the user clicked on. proc invoke index { - global tk_library + global tk_demoDirectory set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] if {$i < 0} { @@ -400,7 +401,7 @@ proc invoke index { .t configure -cursor watch update set demo [string range [lindex $tags $i] 5 end] - uplevel [list source [file join $tk_library demos $demo.tcl]] + uplevel [list source [file join $tk_demoDirectory $demo.tcl]] update .t configure -cursor $cursor @@ -413,7 +414,6 @@ proc invoke index { # is called when the user moves the cursor over a demo description. # proc showStatus index { - global tk_library set tags [.t tag names $index] set i [lsearch -glob $tags demo-*] set cursor [.t cget -cursor] @@ -449,7 +449,7 @@ proc evalShowCode {w} { # used to derive the name of the file containing its code. proc showCode w { - global tk_library + global tk_demoDirectory set file [string range $w 1 end].tcl set top .code if {![winfo exists $top]} { @@ -495,9 +495,9 @@ proc showCode w { wm deiconify $top raise $top } - wm title $top [mc "Demo code: %s" [file join $tk_library demos $file]] + wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file - set id [open [file join $tk_library demos $file]] + set id [open [file join $tk_demoDirectory $file]] $top.f.text delete 1.0 end $top.f.text insert 1.0 [read $id] $top.f.text mark set insert 1.0 |