1#Run this with the wish (Tk shell) that you want to install for.
2#For example: $ wish8.4 install.tcl
3
4proc event.select.install.path win {
5	set i [$win curselection]
6	set ::installPath [$win get $i]
7}
8
9proc install {} {
10	set idir [file join $::installPath ctext]
11	file mkdir $idir
12	file copy -force pkgIndex.tcl $idir
13	file copy -force ctext.tcl $idir
14	tk_messageBox -icon info -message "Successfully installed into $idir" \
15-title {Install Successful} -type ok
16
17	exit
18}
19
20proc main {} {
21	option add *foreground black
22	option add *background gray65
23	. config -bg gray65
24
25	wm title . {Ctext Installer}
26	label .title -text {Welcome to the Ctext installer} -font {Helvetica 14}
27
28	message .msgauto -aspect 300 -text {The auto_path directories are automatically searched by Tcl/Tk for packages.  You may select a directory to install Ctext into, or type in a new directory.  Your auto_path directories are:}
29
30	set autoLen [llength $::auto_path]
31	listbox .listauto -height $autoLen
32
33	for {set i 0} {$i < $autoLen} {incr i} {
34		.listauto insert end [lindex $::auto_path $i]
35	}
36
37	bind .listauto <<ListboxSelect>> [list event.select.install.path %W]
38
39	label .lipath -text {Install Path:}
40	set ::installPath [lindex $::auto_path end]
41	entry .installPath -textvariable ::installPath
42
43	frame .fcontrol
44	frame .fcontrol.finst -relief sunken -bd 1
45	pack [button .fcontrol.finst.install -text Install -command install] -padx 4 -pady 4
46	button .fcontrol.cancel -text Cancel -command exit
47	pack .fcontrol.finst -side left -padx 5
48	pack .fcontrol.cancel -side right -padx 5
49
50	pack .title -fill x
51	pack .msgauto -anchor w
52	pack .listauto -fill both -expand 1
53	pack .lipath -anchor w
54	pack .installPath -fill x
55	pack .fcontrol -pady 10
56}
57main
58