1#!../src/bltwish
2
3package require BLT
4# --------------------------------------------------------------------------
5# Starting with Tcl 8.x, the BLT commands are stored in their own
6# namespace called "blt".  The idea is to prevent name clashes with
7# Tcl commands and variables from other packages, such as a "table"
8# command in two different packages.
9#
10# You can access the BLT commands in a couple of ways.  You can prefix
11# all the BLT commands with the namespace qualifier "blt::"
12#
13#    blt::graph .g
14#    blt::table . .g -resize both
15#
16# or you can import all the command into the global namespace.
17#
18#    namespace import blt::*
19#    graph .g
20#    table . .g -resize both
21#
22# --------------------------------------------------------------------------
23if { $tcl_version >= 8.0 } {
24    namespace import blt::*
25    namespace import -force blt::tile::*
26}
27#source scripts/demo.tcl
28
29option add *takeFocus 0
30
31set file1 ../demos/images/chalk.gif
32set file2 ../demos/images/tan_paper.gif
33image create photo texture1 -file $file1
34image create photo texture2 -file $file2
35option add *Frame.Tile texture1
36option add *Toplevel.Tile texture1
37option add *Label.Tile texture1
38option add *Scrollbar.tile texture1
39#option add *Scrollbar.activeTile texture2
40option add *Button.tile texture1
41#option add *Button.activeTile texture2
42option add *HighlightThickness 0
43option add *Entry.highlightThickness 2
44
45#
46# Initialization of global variables and Tk resource database
47#
48#
49# Resources available
50#
51# Tk.normalBgColor:
52# Tk.normalFgColor:
53# Tk.focusHighlightColor:
54# Tk.statusFont:
55# Tk.titleFont:
56# Tk.headingFont:
57# Tk.subheadingFont:
58# Tk.entryFont:
59# Tk.textFont:
60#
61
62#debug 50
63bitmap define attlogo { { 60 30 } {
64    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
68    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x7e, 0x00,
69    0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
70    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xf8, 0x03,
71    0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x83, 0xf9, 0x87, 0x7f, 0x00,
72    0x00, 0x00, 0x00, 0x80, 0xf9, 0x87, 0x7f, 0x00, 0x40, 0x00, 0xf0, 0xc7,
73    0xc3, 0x38, 0x0c, 0x00, 0xc0, 0xff, 0xff, 0xc7, 0xc3, 0x7c, 0x0c, 0x00,
74    0x00, 0x00, 0x00, 0x40, 0xc2, 0x6c, 0x0c, 0x00, 0x40, 0x00, 0xf8, 0x67,
75    0xc6, 0x9c, 0x0d, 0x00, 0xc0, 0xff, 0xff, 0xe7, 0xc7, 0xf8, 0x0d, 0x00,
76    0x00, 0x00, 0x00, 0xe0, 0xc7, 0xec, 0x0c, 0x00, 0x80, 0x01, 0xfe, 0x33,
77    0xcc, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x33, 0xcc, 0xb8, 0x0d, 0x00,
78    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00,
79    0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
80    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x00,
81    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
84}
85
86bitmap define globe_00 { { 32 32 } {
87    00 40 02 00 00 1c 3c 00 00 01 fe 00 80 80 fe 03 60 00 ff 07 10 c0 f1 0f
88    00 80 c0 1f 00 c0 07 3f 00 c0 ff 3f 00 f0 ff 4f 02 f0 ff 5d 00 f0 ff 1b
89    00 f0 ff 8f 02 f0 ff 0f 06 e0 fc 0f 0e 00 f8 0f 0f 00 f8 07 3f 00 f8 03
90    7e 00 f0 03 7e 00 f0 03 3e 00 f0 0b 3c 00 f0 09 3c 00 f0 01 18 00 f0 00
91    18 00 70 00 10 00 00 00 10 00 00 00 20 00 00 00 40 00 00 00 00 00 00 00
92    00 00 00 00 00 00 1f 00 }
93}
94
95bitmap define globe_01 { { 32 32 } {
96    00 c0 00 00 00 34 38 00 00 02 e8 00 80 01 fa 03 e0 00 fc 07 30 00 e6 0f
97    10 00 86 1f 08 00 3e 3c 04 00 ff 3f 04 80 ff 5f 02 80 ff 3f 00 80 ff 2f
98    00 80 ff 3f 0c 00 ff 3f 1c 00 ee 3f 3c 00 c0 3f 7e 00 c0 1f fe 01 80 1f
99    fc 03 80 1f fc 01 80 1f fc 01 80 2f f8 01 80 0f f0 00 80 17 f0 00 80 03
100    f0 00 80 03 60 00 00 00 60 00 00 00 40 00 00 00 80 00 00 00 00 00 00 00
101    00 00 00 00 00 00 1e 00 }
102}
103
104bitmap define globe_02 { { 32 32 } {
105    00 c0 01 00 00 60 30 00 00 04 f0 00 80 07 e0 03 e0 01 f0 07 f0 00 38 0f
106    30 00 10 1e 18 00 f0 30 04 00 f8 3f 10 00 f8 7f 12 00 fc 7f 02 00 fc 7f
107    04 00 fc 7f 74 00 f8 7f f0 00 70 7f f8 01 00 7e f8 03 00 7e f8 0f 00 7c
108    f8 1f 00 3c f0 1f 00 3c f0 0f 00 3e e0 0f 00 5e c0 07 00 1c c0 03 00 0e
109    c0 03 00 04 80 01 00 00 80 01 00 00 80 01 00 00 00 01 00 00 00 00 00 00
110    00 00 00 00 00 10 1c 00 }
111}
112
113bitmap define globe_03 { { 32 32 } {
114    00 c0 01 00 00 dc 20 00 00 09 c0 00 80 1f a0 03 e0 07 c0 07 f0 01 c0 0c
115    f8 00 40 18 78 00 c0 23 08 00 c0 3f 04 00 e0 7f 54 00 e0 7f 0c 00 c0 7f
116    10 00 c0 ff d0 01 c0 ff c0 03 80 fb e0 0f 00 f0 e0 1f 00 f0 e0 ff 00 f0
117    e0 ff 00 70 c0 ff 00 70 c0 7f 00 70 00 7f 00 70 00 3f 00 30 00 1f 00 38
118    00 1f 00 18 00 0e 00 00 00 06 00 00 00 02 00 00 00 04 00 00 00 00 00 00
119    00 00 00 00 00 20 18 00 }
120}
121
122bitmap define globe_04 { { 32 32 } {
123    00 c0 03 00 00 7c 03 00 00 13 00 00 80 7f c0 03 c0 1f 00 07 e0 0f 00 0d
124    f0 03 00 10 f0 01 00 0e 38 01 00 3e 10 00 00 7f 50 00 00 7f 30 00 00 7f
125    40 00 00 ff 00 1e 00 fe 00 3f 00 ec 00 7f 00 c0 00 ff 00 c0 00 ff 07 c0
126    00 ff 0f c0 00 fe 07 c0 00 fe 07 c0 00 f8 03 40 00 f8 01 60 00 f8 00 20
127    00 f8 00 20 00 38 00 00 00 18 00 00 00 18 00 00 00 18 00 00 00 00 00 00
128    00 00 00 00 00 40 10 00 }
129}
130
131bitmap define globe_05 { { 32 32 } {
132    00 c0 03 00 00 bc 06 00 00 cf 00 00 80 ff 01 02 c0 7f 00 06 c0 3f 00 0e
133    e0 1f 00 14 e0 0f 00 18 e0 00 00 38 60 00 00 78 40 08 00 78 c0 01 00 78
134    00 02 00 f8 00 f0 00 f0 00 f0 01 b0 00 f8 07 80 00 f8 0f 80 00 f8 3f 00
135    00 f8 7f 00 00 f0 3f 80 00 f0 3f 80 00 c0 1f 00 00 c0 0f 00 00 c0 07 40
136    00 c0 07 00 00 c0 01 00 00 e0 00 00 00 60 00 00 00 40 00 00 00 00 00 00
137    00 00 00 00 00 80 10 00 }
138}
139
140bitmap define globe_06 { { 32 32 } {
141    00 80 07 00 00 7c 0d 00 00 9f 03 00 00 ff 07 02 00 ff 03 04 80 ff 00 08
142    c0 7f 00 00 80 3f 00 30 80 07 00 20 00 03 00 60 00 03 00 60 00 0e 00 60
143    00 10 00 e0 00 80 07 c0 00 80 0f c0 00 80 3f 00 00 c0 7f 00 00 c0 ff 01
144    00 c0 ff 03 00 80 ff 01 00 80 ff 01 00 00 fe 00 00 00 7e 00 00 00 3e 00
145    00 00 1f 00 00 00 0f 00 00 00 03 00 00 00 03 00 00 00 01 00 00 00 00 00
146    00 00 00 00 00 00 01 00 }
147}
148
149bitmap define globe_07 { { 32 32 } {
150    00 80 07 00 00 fc 1a 00 00 7d 02 00 00 fe 1f 00 00 fe 0f 00 00 fe 07 00
151    00 ff 03 00 00 fe 01 20 00 1c 01 00 00 1c 00 40 00 18 00 40 00 70 00 00
152    00 80 00 80 00 00 39 80 00 00 7c 00 00 00 fc 01 00 00 fe 03 00 00 fe 0f
153    00 00 fc 0f 00 00 fc 0f 00 00 f8 07 00 00 f0 07 00 00 f0 03 00 00 f0 01
154    00 00 f8 00 00 00 38 00 00 00 18 00 00 00 0c 00 00 00 04 00 00 00 00 00
155    00 00 00 00 00 00 02 00 }
156}
157
158bitmap define globe_08 { { 32 32 } {
159    00 00 07 00 00 fc 25 00 00 f8 19 00 00 f8 7f 00 00 f8 3f 00 00 f8 1f 00
160    00 f8 1f 00 00 f8 0f 00 00 f0 08 00 00 f0 00 00 00 c0 04 00 00 80 03 00
161    00 00 0c 00 00 00 c8 01 00 00 e0 03 00 00 e0 0f 00 00 e0 0f 00 00 f0 3f
162    00 00 e0 3f 00 00 e0 3f 00 00 c0 1f 00 00 80 1f 00 00 80 0f 00 00 c0 07
163    00 00 c0 03 00 00 c0 01 00 00 60 00 00 00 30 00 00 00 10 00 00 00 00 00
164    00 00 00 00 00 00 04 00 }
165}
166
167bitmap define globe_09 { { 32 32 } {
168    00 00 03 00 00 fc 27 00 00 f0 13 00 00 e0 ff 00 00 e0 ff 01 00 e0 7f 00
169    00 e0 7f 00 00 c0 7f 00 00 80 47 00 00 80 07 00 00 00 26 00 00 00 1c 00
170    00 00 60 00 00 00 40 0e 00 00 00 1f 00 00 00 3f 00 00 00 3f 00 00 00 7f
171    00 00 00 7f 00 00 00 7f 00 00 00 7e 00 00 00 3c 00 00 00 3e 00 00 00 1e
172    00 00 00 0f 00 00 00 07 00 00 80 01 00 00 80 00 00 00 40 00 00 00 00 00
173    00 00 00 00 00 00 08 00 }
174}
175
176bitmap define globe_10 { { 32 32 } {
177    00 00 06 00 00 f4 2f 00 00 c8 4f 00 00 80 ff 01 00 80 ff 01 00 80 ff 01
178    00 00 ff 01 00 00 fe 01 00 00 3c 00 00 00 3c 00 00 00 30 04 00 00 e0 00
179    00 00 00 01 00 00 00 3a 00 00 00 38 00 00 00 78 00 00 00 f8 00 00 00 fc
180    00 00 00 f8 00 00 00 f8 00 00 00 f8 00 00 00 70 00 00 00 70 00 00 00 38
181    00 00 00 18 00 00 00 0c 00 00 00 06 00 00 00 03 00 00 00 00 00 00 00 00
182    00 00 00 00 00 00 10 00 }
183}
184
185bitmap define globe_11 { { 32 32 } {
186    00 00 06 00 00 ec 1f 00 00 91 9f 00 00 00 fe 03 00 00 fc 07 00 00 fc 07
187    00 00 fc 07 00 00 f0 07 00 00 f0 01 00 00 e0 00 00 00 80 05 00 00 00 07
188    00 00 00 08 00 00 00 60 00 00 00 e0 00 00 00 e0 00 00 00 e0 00 00 00 e0
189    01 00 00 e0 00 00 00 e0 00 00 00 e0 00 00 00 40 00 00 00 60 00 00 00 60
190    00 00 00 30 00 00 00 10 40 00 00 08 40 00 00 04 00 00 00 00 00 00 00 00
191    00 00 00 00 00 00 10 00 }
192}
193
194bitmap define globe_12 { { 32 32 } {
195    00 00 04 00 00 dc 3f 00 00 42 7e 00 00 00 f8 03 20 00 f0 07 10 00 f0 0f
196    00 00 e0 0f 00 00 c0 0f 00 00 00 07 00 00 00 06 00 00 00 14 00 00 00 18
197    00 00 00 20 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 01 00 00 80
198    00 00 00 80 00 00 00 80 02 00 00 80 02 00 00 00 04 00 00 40 04 00 00 40
199    08 00 00 20 08 00 00 00 00 00 00 10 00 00 00 08 00 00 00 00 00 00 00 00
200    00 00 00 00 00 00 00 00 }
201}
202
203bitmap define globe_13 { { 32 32 } {
204    00 00 04 00 00 bc 3f 00 00 01 79 00 80 00 e0 03 60 00 c0 07 10 00 80 0f
205    00 00 80 1f 08 00 00 1e 00 00 00 1c 00 00 00 58 00 00 00 10 00 00 00 20
206    00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 06 00 00 00
207    04 00 00 00 00 00 00 00 02 00 00 00 0e 00 00 00 0c 00 00 00 1c 00 00 00
208    18 00 00 00 30 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00
209    00 00 00 00 00 10 00 00 }
210}
211
212bitmap define globe_14 { { 32 32 } {
213    00 00 00 00 00 fc 3f 00 00 03 e6 00 80 01 c0 03 60 00 00 07 30 00 00 0f
214    00 00 00 1e 00 00 00 38 04 00 00 30 00 00 00 30 02 00 00 00 00 00 00 40
215    00 00 00 80 00 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 18 00 00 00
216    00 00 00 00 00 00 00 00 14 00 00 00 3c 00 00 00 3c 00 00 00 7c 00 00 00
217    78 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
218    00 00 00 00 00 30 00 00 }
219}
220
221bitmap define globe_15 { { 32 32 } {
222    00 00 00 00 00 fc 3d 00 00 27 c8 00 80 13 00 03 e0 01 00 06 70 00 00 0c
223    10 00 00 18 18 00 00 30 0c 00 00 20 0c 00 00 40 02 00 00 00 02 00 00 00
224    00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 13 00 00 00 64 00 00 00
225    c0 00 00 00 00 00 00 00 30 00 00 00 f8 00 00 00 f8 01 00 00 f8 03 00 00
226    f0 03 00 00 80 03 00 00 00 80 00 00 00 40 00 00 00 00 00 00 00 00 00 00
227    00 00 00 00 00 70 00 00
228  }
229}
230
231bitmap define globe_16 { { 32 32 } {
232    00 00 00 00 00 fc 3b 00 00 9f a0 00 80 4f 00 02 e0 0f 00 04 f0 01 00 08
233    70 00 00 10 38 00 00 20 3c 00 00 00 1c 00 00 00 06 00 00 00 04 00 00 00
234    04 00 00 00 00 00 00 00 20 00 00 00 0a 00 00 00 0a 00 00 00 00 03 00 00
235    28 06 00 00 00 00 00 00 c0 02 00 00 e0 07 00 00 f0 0f 00 00 e0 1f 00 00
236    e0 1f 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00
237    00 00 00 00 00 f0 00 00 }
238}
239
240bitmap define globe_17 { { 32 32 } {
241    00 00 00 00 00 fc 37 00 00 3f 42 00 80 3f 01 02 e0 1f 00 00 f0 07 00 00
242    f0 11 00 00 f8 04 00 00 fc 00 00 00 7c 00 00 00 1a 00 00 00 9a 00 00 00
243    18 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 28 00 00 00 08 18 00 00
244    00 30 00 00 00 10 00 00 00 17 00 00 00 3f 00 00 c0 7f 00 00 80 7f 00 00
245    80 7f 00 00 00 70 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00
246    00 00 00 00 00 f0 01 00
247  }
248}
249
250bitmap define globe_18 { { 32 32 } {
251    00 00 00 00 00 fc 2f 00 00 ff 84 00 80 ff 04 00 e0 7f 00 00 f0 9f 00 00
252    f0 97 00 00 f8 27 00 00 fc 07 00 00 fc 03 00 00 6c 00 00 00 64 00 00 00
253    60 04 00 00 40 00 00 00 20 00 00 00 20 01 00 00 a0 01 00 00 00 c0 05 00
254    00 88 00 00 00 00 00 00 00 38 01 00 00 fc 01 00 00 fe 03 00 00 fe 03 00
255    00 fc 03 00 00 80 03 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 00
256    00 00 00 00 00 f0 03 00
257  }
258}
259
260bitmap define globe_19 { { 32 32 } {
261    00 40 00 00 00 fc 3f 00 00 ff 13 00 80 ff 13 00 e0 ff 03 00 f0 ff 00 00
262    f0 9f 00 00 f8 3f 00 00 fc 3f 00 00 f8 1f 00 00 ba 07 00 00 98 23 00 00
263    08 03 00 00 08 00 00 00 00 00 00 00 80 09 00 00 00 0d 01 00 00 21 0e 00
264    00 00 1c 00 00 00 00 00 00 c0 09 00 00 e0 0f 00 00 f0 1f 00 00 f0 1f 00
265    00 f0 1f 00 00 00 0e 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00
266    00 00 00 00 00 f0 07 00
267  }
268}
269
270bitmap define globe_20 { { 32 32 } {
271    00 00 00 00 00 fc 3f 00 00 ff 07 00 80 ff 0f 00 e0 ff 0f 00 f0 ff 13 00
272    f0 ff 10 00 f8 ff 00 00 fc ff 01 00 f4 ff 00 00 e6 1e 00 00 62 1c 01 00
273    20 18 00 00 20 10 00 00 01 80 00 00 01 cc 00 00 01 68 08 00 00 00 60 00
274    00 00 c0 00 00 00 00 00 00 00 5c 00 00 00 7e 00 00 80 ff 00 00 80 ff 00
275    00 80 ff 00 00 00 70 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00
276    00 00 00 00 00 f0 0f 00
277  }
278}
279
280bitmap define globe_21 { { 32 32 } {
281    00 80 00 00 00 fc 3f 00 00 ff 1f 00 80 ff bf 00 e0 ff 3f 00 f0 ff 1f 00
282    f8 ff 17 00 f8 ff 27 00 ec ff 0f 00 8c ff 07 00 9e f7 00 00 0e e3 00 00
283    06 c1 00 00 06 81 10 00 03 40 04 00 03 20 06 00 03 40 06 00 01 80 00 03
284    01 00 00 02 02 00 00 00 02 00 e0 02 02 00 f0 03 00 00 fc 03 00 00 fc 03
285    00 00 fc 03 00 00 c0 01 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00
286    00 00 00 00 00 f0 1f 00 }
287}
288
289bitmap define globe_22 { { 32 32 } {
290    00 00 01 00 00 fc 3f 00 00 ff 3f 00 80 ff 7f 00 e0 ff ff 00 f0 ff 7f 00
291    f0 ff 1f 00 e0 ff 3f 00 fc ff 3f 00 34 fe 3f 00 76 bc 07 00 36 1c 07 00
292    0e 08 0e 00 1e 08 80 00 0f 00 02 00 0f 00 20 00 07 00 36 00 07 00 04 08
293    07 00 00 18 06 00 00 00 16 00 00 0b 16 00 80 0f 04 00 e0 0f 04 00 e0 0f
294    08 00 e0 0f 00 00 00 06 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00
295    00 00 00 00 00 f0 1f 00 }
296}
297
298bitmap define globe_23 { { 32 32 } {
299    00 00 00 00 00 fc 3f 00 00 ff 7f 00 80 ff ff 01 e0 ff ff 01 e0 ff ff 01
300    e8 ff ff 00 c0 ff ff 00 fc fe ff 01 dc f2 ff 01 de e3 3d 00 de e1 38 02
301    7e 40 70 00 fe 40 00 04 7f 00 00 00 3e 00 30 01 3e 00 a0 01 1e 00 20 20
302    1e 00 00 20 1c 00 00 00 9c 00 00 3c 1c 00 00 3e 1c 00 00 3f 18 00 80 3f
303    10 00 00 1f 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
304    00 00 00 00 00 f0 1f 00 }
305}
306
307bitmap define globe_24 { { 32 32 } {
308    00 00 02 00 00 fc 3f 00 00 fe ff 00 80 ff ff 01 c0 ff ff 03 80 ff ff 03
309    e0 ff ff 03 18 ff ff 03 fc ff ff 07 7c 87 ff 07 fe 1f ef 01 fe 0e c6 01
310    fe 01 82 03 fe 03 02 00 ff 03 00 08 fc 01 80 09 fc 00 00 0d fc 00 00 00
311    f8 00 00 80 f8 00 00 00 f8 00 00 20 78 02 00 70 70 02 00 7c 70 00 00 3c
312    60 00 00 3c 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
313    00 00 00 00 00 f0 1f 00 }
314}
315
316bitmap define globe_25 { { 32 32 } {
317    00 00 00 00 00 f0 3f 00 00 fc ff 00 80 ff ff 03 80 ff ff 07 a0 ff ff 07
318    10 ff ff 07 30 f8 ff 0f f8 df ff 1f fc 3b fc 1f fc fb 78 07 fe 77 30 0e
319    fe 1f 30 0c fe 3f 00 48 fe 1f 00 00 f0 0f 00 24 f0 07 00 a0 f0 07 00 08
320    e0 07 00 00 e0 07 00 00 e0 27 00 c0 e0 13 00 40 c0 13 00 70 c0 03 00 70
321    80 01 00 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
322    00 00 00 00 00 f0 1f 00 }
323}
324
325bitmap define globe_26 { { 32 32 } {
326    00 40 00 00 00 e0 3f 00 00 e8 ff 00 00 fc ff 03 00 ff ff 07 c0 fe ff 0f
327    40 f0 ff 1f e0 e0 ff 1f f0 ff fe 3f f8 df e1 3f f8 df c7 1b fc bf 83 19
328    fc ff 80 30 fc ff 01 20 f8 ff 00 00 c0 ff 00 00 c0 7f 00 e0 80 3f 00 20
329    80 3f 00 00 80 3f 00 00 80 3f 01 80 80 9f 00 00 00 9f 00 40 00 0f 00 60
330    00 0e 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
331    00 00 00 00 00 f0 1f 00 }
332}
333
334bitmap define globe_27 { { 32 32 } {
335    00 80 00 00 00 c4 3f 00 00 f0 ff 00 00 fe ff 03 00 fe ff 07 00 eb ff 0f
336    80 c9 ff 1f 80 07 ff 3f c0 ff f7 3f e0 ff 0e 7f f0 ff 3e 6e f0 ff 1d 64
337    f0 ff 07 44 f0 ff 0f 00 60 ff 0f 00 00 fe 07 40 00 fe 03 00 01 fc 01 00
338    01 fc 01 00 00 fc 01 00 00 fc 09 00 02 fc 08 00 00 f8 04 00 00 78 00 40
339    00 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
340    00 00 00 00 00 e0 1f 00 }
341}
342
343bitmap define globe_28 { { 32 32 } {
344    00 00 00 00 00 88 3f 00 00 40 ff 00 00 e8 ff 03 00 f8 ff 07 00 8c ff 0f
345    00 06 fe 1f 00 1e f8 3f 00 ff bf 3f 80 ff 77 7c 80 ff ff 79 c0 ff ef 10
346    c0 ff 3f 90 c0 ff 7f 00 81 fb 7f 00 01 f0 3f 00 01 f0 1f 00 03 e0 1f 00
347    07 e0 0f 00 02 c0 1f 00 02 e0 5f 00 06 e0 47 00 04 c0 27 00 04 c0 03 00
348    00 80 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
349    00 00 00 00 00 c0 1f 00 }
350}
351
352bitmap define globe_29 { { 32 32 } {
353    00 40 01 00 00 0c 3f 00 00 80 fd 00 00 a0 ff 03 20 e0 ff 07 00 30 fd 0f
354    00 10 f4 1f 00 f8 c0 3f 00 f8 ff 3f 00 fc bf 73 00 fe ff 67 00 fe 7f 47
355    00 fe ff 41 00 fe ff 03 01 dc ff 03 03 00 ff 01 07 80 ff 00 0f 00 ff 00
356    1f 00 7e 00 0e 00 fe 00 0e 00 ff 02 0e 00 3f 01 0c 00 3e 01 0c 00 1e 00
357    08 00 1c 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
358    00 00 00 00 00 80 1f 00 }
359}
360
361# ----------------------------------------------------------------
362#
363# SetOption --
364#
365#	Sets the option array associated with the resource. It
366# 	first check to see if the resource exists in the option
367#	data base, otherwise it uses the default value given.
368#
369#
370# Arguments
371#	name		-- Name of the resource. Used as index into
372#			   the option array.
373#	value		-- default value given.
374# Globals
375#	pq_dict  	-- Associative array where the option resources
376#			   are stored.
377#
378# ----------------------------------------------------------------
379
380proc SetOption { name value } {
381    global pq_dict
382    set widgetOption [option get . $name Tk]
383    if { $widgetOption != "" } {
384	set value $widgetOption
385    }
386    set pq_dict($name) $value
387}
388
389set pq_dict(textIndex) {}
390
391set pq_dict(entryNames) {
392    last first middle
393    area exch ext
394    com org tl
395    room oldloc loc
396    street
397    city state zip
398    ema
399}
400
401set pq_dict(numEntries) [llength $pq_dict(entryNames)]
402set pq_dict(index) 0
403set pq_dict(defaults) {}
404
405set cnt 0
406foreach name $pq_dict(entryNames) {
407    if { $cnt > 0 } {
408	set pq_dict(format) $pq_dict(format):%$name
409    } else {
410	set pq_dict(format) %$name
411    }
412    incr cnt
413}
414
415set visual [winfo screenvisual .]
416if { ($visual == "staticgray") || ($visual == "grayscale") } {
417    option add *Entry.background white
418    option add *Text.background white
419    set pq_dict(visual) mono
420} else {
421    set depth [winfo screendepth .]
422    if { $depth < 8 } {
423	SetOption normalBgColor grey
424	SetOption normalFgColor black
425	SetOption focusHighlightColor white
426    } else {
427#fff4de
428	SetOption normalBgColor grey90
429	SetOption normalFgColor #da5f5f
430	SetOption normalFgColor navyblue
431	SetOption focusHighlightColor #fffdf8
432    }
433    option add *Entry.background $pq_dict(normalBgColor) widgetDefault
434    option add *Text.background $pq_dict(normalBgColor) widgetDefault
435    option add *Label.foreground $pq_dict(normalFgColor) widgetDefault
436    option add *Button.foreground $pq_dict(normalFgColor) widgetDefault
437    set pq_dict(visual) color
438}
439
440SetOption statusFont 	 -*-Helvetica-Medium-R-*-*-14-*-*-*-*-*-*-*
441SetOption titleFont	 -*-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*
442SetOption headingFont 	 -*-Helvetica-Medium-R-*-*-14-*-*-*-*-*-*-*
443SetOption subheadingFont -*-Helvetica-Medium-R-*-*-12-*-*-*-*-*-*-*
444SetOption entryFont 	 -*-Courier-Medium-R-*-*-12-*-*-*-*-*-*-*
445SetOption textFont 	 -*-Courier-Bold-R-*-*-12-*-*-*-*-*-*-*
446#SetOption entryFont 	 fixed
447#SetOption textFont 	 fixed
448
449option add *Label.borderWidth 	0		    widgetDefault
450option add *Entry.relief 	sunken              widgetDefault
451option add *Entry.width 	11		    widgetDefault
452option add *Entry.borderWidth 	2		    widgetDefault
453option add *Entry.font 		$pq_dict(entryFont) widgetDefault
454option add *Text.font		$pq_dict(textFont)  widgetDefault
455option add *Text.width 		35		    widgetDefault
456option add *Text.height 	10 		    widgetDefault
457option add *Scrollbar.relief 	flat		    widgetDefault
458option add *Scrollbar.minSlider	10		    widgetDefault
459option add *Button.padY 6
460option add *Text.relief 	sunken		    widgetDefault
461option add *Text.borderWidth 	2 		    widgetDefault
462
463foreach name $pq_dict(entryNames) {
464    option add *${name}_label.font $pq_dict(subheadingFont) widgetDefault
465}
466
467option add *Label.Font          $pq_dict(subheadingFont)
468option add *status_label.font   $pq_dict(statusFont)  widgetDefault
469option add *name_label.font   	$pq_dict(headingFont) widgetDefault
470option add *tel_label.font 	$pq_dict(headingFont) widgetDefault
471option add *office_label.font 	$pq_dict(headingFont) widgetDefault
472option add *addr_label.font 	$pq_dict(headingFont) widgetDefault
473option add *loc_title.font 	$pq_dict(headingFont) widgetDefault
474option add *org_title.font 	$pq_dict(headingFont) widgetDefault
475
476option add *overall_label.text	"Customer Database"
477option add *name_label.text	"Name"
478option add *tel_label.text 	"Telephone"
479option add *addr_label.text	"Address"
480option add *last_label.text	"last"
481option add *first_label.text	"first"
482option add *middle_label.text	"middle"
483option add *com_label.text	"company"
484option add *org_label.text      "organization"
485option add *tl_label.text	"title"
486option add *ext_label.text	"extension"
487option add *exch_label.text	"exchange"
488option add *area_label.text	"area code"
489option add *loc_label.text	"extension"
490option add *oldloc_label.text	"exchange"
491option add *room_label.text	"area code"
492option add *street_label.text	"street address"
493option add *ema_label.text	"e-mail"
494option add *city_label.text	"city"
495option add *state_label.text	"state"
496option add *zip_label.text	"zip code"
497option add *org_title.text	"Organization"
498option add *loc_title.text	"Fax"
499
500option add *clear_button.text	"Clear"
501option add *quit_button.text	"Quit"
502option add *cancel_button.text	"Cancel"
503
504# --------------------------------------------------------------------------
505#
506# Procedures to perform post queries
507#
508
509# ----------------------------------------------------------------
510#
511# StopQuery --
512#
513#	Stops any current "pq" request by setting the variable
514#	associated with the background subprocesses.
515#
516# Arguments
517#	None.
518#
519# Globals
520#	postOutput 	-- variable where collected output from
521#			   pq command will be stored
522#
523# ----------------------------------------------------------------
524
525proc StopQuery {} {
526    global postOutput
527    set postOutput {}
528}
529
530
531# ----------------------------------------------------------------
532#
533# PostQuery --
534#
535#	Collects the data from the entry widget fields and
536#	executes a "pq" request.  The "pq" command is executed
537#	in the background and a "wait" is setup to wait for the
538#	command to finish.  This allows the animation routine
539#	to operate and exposure events to be handled properly.
540#
541# Arguments
542#	None.
543#
544# Globals
545#	postOutput 	    -- variable where collected output from
546#			       pq command will be stored
547#	pq_dict(entryNames) -- list of entry widget names
548#	pq_dict(textIndex)  -- starting index of highlighted information
549#			       (a line in the text widget)
550#
551# ----------------------------------------------------------------
552
553proc PostQuery {} {
554    global pq_dict
555
556    .status_label configure -text {}
557    set cnt 0
558    foreach name $pq_dict(entryNames) {
559	set value [.${name}_entry get]
560	if { $value != "" } {
561	    set value [split $value "|"]
562    	    foreach i $value {
563	        if { $cnt > 0 } {
564		    set query $query/$name=[list $i]
565	        } else {
566		    set query $name=[list $i]
567	        }
568	        incr cnt
569 	    }
570	}
571    }
572    if { $cnt == 0 } {
573	return
574    }
575    set fmt {%^24pn\t%10org\t%6loc\t%area-%exch-%ext\t%ema}
576    global postOutput postError
577    set postOutput {}
578    set postError {}
579    bgexec postStatus -error postError -output postOutput \
580	pq -o $fmt $query &
581    Animate on
582    tkwait variable postStatus
583    if { $postOutput != "" } {
584	.text configure -state normal
585	.text delete 0.0 end
586	.text insert 0.0 $postOutput
587	.text configure -state disabled
588	.status_label configure -text "Post query successful"
589    } else {
590	.status_label configure -text "Post query failed"
591    }
592    set pq_dict(textIndex) {}
593    Animate off
594    if { $postError != "" }  {
595        tkerror $postError
596    }
597}
598
599
600# ----------------------------------------------------------------
601#
602# ClearFields --
603#
604#	Clears the all the entry fields.
605#
606# Arguments
607#	None.
608#
609# Globals
610#	pq_dict(entryNames) -- list of entry widget names
611#	pq_dict(textIndex)  -- starting index of highlighted information
612#			       (a line in the text widget)
613#
614# ----------------------------------------------------------------
615
616proc ClearFields {} {
617    global pq_dict
618
619    busy hold . ; update
620    foreach name $pq_dict(entryNames) {
621	.${name}_entry delete 0 end
622    }
623    set pq_dict(textIndex) {}
624    .status_label configure -text "Cleared query fields"
625    busy release .
626}
627
628
629# ----------------------------------------------------------------
630#
631# FillFields --
632#
633#	Makes a post query based upon the highlighted line in
634#	the text widget to fill in all post entry fields.
635#
636# Arguments
637#	x		    x screen coordinate
638#	y 		    y screen coordinate
639#
640# Globals
641#	postOutput 	    variable where collected output from pq
642#			    command will be stored
643#	pq_dict(format)     standard query format to collect data for
644#			    all entry fields
645#	pq_dict(entryNames) list of entry widget names
646#
647# ----------------------------------------------------------------
648
649proc FillFields { x y } {
650    global pq_dict
651
652    set info [.text get [list @$x,$y linestart] [list @$x,$y lineend]]
653    set info [split $info \t]
654    if { [llength $info] == 0 } {
655	return
656    }
657    set name [string trim [lindex $info 0]]
658    set name [split $name ,]
659    set last [lindex $name 0]
660    set name [split [lindex $name 1]]
661    set first [lindex $name 0]
662    set middle [lindex $name 1]
663    set org [string trim [lindex $info 1]]
664    set loc [string trim [lindex $info 2]]
665    set tel [string trim [lindex $info 3]]
666    set query last=$last/first=$first/middle=$middle/org=$org/loc=$loc/tel=[list $tel]
667    global postOutput
668    set postOutput {}
669    bgexec postStatus -output postOutput \
670	pq -o $pq_dict(format) $query &
671    Animate on
672    tkwait variable postStatus
673
674    if { $postOutput == "" } {
675	# Try again with out the telephone number
676	set query last=$last/first=$first/middle=$middle/org=$org/loc=$loc
677	set postStatus {}
678	bgexec postStatus -output postOutput \
679		pq -o $pq_dict(format) $query &
680	tkwait variable postStatus
681    }
682    Animate off
683    if { $postOutput == "" } {
684	.status_label configure -text "Post query failed"
685    } else {
686        .status_label configure -text "Post database fields found"
687        set postOutput [split $postOutput : ]
688	set cnt 0
689	foreach name $pq_dict(entryNames) {
690	    .${name}_entry delete 0 end
691	    .${name}_entry insert 0 [lindex $postOutput $cnt]
692	    incr cnt
693	}
694    }
695}
696
697
698# ----------------------------------------------------------------
699#
700# HighlightText --
701#
702#	Highlight the text under the current line (as based upon
703#	the given screen coordinates.  Only highlight the line if
704#	pointer has been moved to the another line.
705#
706# Arguments
707#	x		    x screen coordinate
708#	y 		    y screen coordinate
709#
710# Globals
711#	pq_dict(visual)     either "mono" or "color"; indicates if
712#			    color screen features can be used
713#	pq_dict(textIndex)  starting index of highlighted information
714#	pq_dict(normalFgColor)    color to use for highlighted region
715#
716# ----------------------------------------------------------------
717
718proc HighlightText { x y } {
719    global pq_dict
720
721    set newIndex [.text index [list @$x,$y linestart]]
722    if { $newIndex != $pq_dict(textIndex) } {
723	catch { .text tag delete highlight }
724	.text tag add highlight $newIndex [list $newIndex lineend]
725	if { $pq_dict(visual) == "color" } {
726	    .text tag configure highlight \
727		-foreground $pq_dict(normalFgColor) -underline on
728	} else {
729	    .text tag configure highlight -underline on
730	}
731	set pq_dict(textIndex) $newIndex
732    }
733}
734
735
736# ----------------------------------------------------------------
737#
738# ChangeFocus --
739#
740#	Change the keyboard focus to the next/last entry widget.
741#
742# Arguments
743#	direction	    either "next" or "last"; indicates in
744#			    which direction to change focus
745#
746# Globals
747#	pq_dict(entryNames) list of entry widget names
748#	pq_dict(index)      current index in list of entry widget
749#			    names of the keyboard focus. An index
750#			    of -1 indicates there is no focus.
751#	pq_dict(numEntries) number of names in entry widget list
752#
753# ----------------------------------------------------------------
754
755proc ChangeFocus direction {
756    global pq_dict
757
758    case $direction {
759	next {
760	    incr pq_dict(index)
761	    if { $pq_dict(index) == $pq_dict(numEntries) } {
762		set pq_dict(index) 0
763	    }
764	}
765	last {
766	    set pq_dict(index) [expr $pq_dict(index)-1]
767	    if { $pq_dict(index) < 0 } {
768		set pq_dict(index) [expr $pq_dict(numEntries)-1]
769	    }
770	}
771    }
772    focus .[lindex $pq_dict(entryNames) $pq_dict(index)]_entry
773    update idletasks
774    update
775}
776
777
778# ----------------------------------------------------------------
779#
780# ColorFocus --
781#
782#	Change background color of entry widget with active
783#	keyboard focus
784#
785# Arguments
786#	w		    name of entry widget to change
787#	bool		    either "on" or "off"; indicates if
788#			    the focus highlight should turned on
789#			    or off.
790#
791# Globals
792#	pq_dict(entryNames) list of entry widget names
793#	pq_dict(index)      current index in list of entry widget
794#			    names of the keyboard focus. An index
795#			    of -1 indicates there is no focus.
796#	pq_dict(visual)     either "mono" or "color"; indicates if
797#			    color screen features can be used
798#
799# ----------------------------------------------------------------
800
801proc ColorFocus { w bool } {
802    global pq_dict
803
804    regexp {\.([a-z]+)_entry} $w dummy name
805    if { $pq_dict(visual) == "color" && [info commands $w] == $w } {
806	if { $bool == "on" } {
807	    set pq_dict(index) [lsearch $pq_dict(entryNames) $name]
808	    $w configure -background $pq_dict(focusHighlightColor)
809        } else {
810	    $w configure -background $pq_dict(normalBgColor)
811        }
812    }
813}
814
815# ----------------------------------------------------------------
816#
817# Animate --
818#
819#	Activates/deactivates an animated bitmap and busy window.
820#	A cancel button is mapped and raised so that it is unaffected
821#	by the busy window.
822#
823# Arguments
824#	option		    either "on", "off", or "continue";
825#			    indicates whether animation should
826#			    be started, stoped or continued.
827#
828# Globals
829#	pq_dict(entryNames) list of entry widget names
830#	pq_dict(index)      current index in list of entry widget
831#			    names of the keyboard focus. An index
832#			    of -1 indicates there is no focus.
833#	pq_dict(visual)     either "mono" or "color"; indicates if
834#			    color screen features can be used
835#
836# ----------------------------------------------------------------
837
838set pq_dict(curBitmap) 0
839set pq_dict(lastBitmap) 0
840
841proc Animate option {
842    global pq_dict
843
844    case $option {
845	on {
846	    busy hold .
847	    .status_label configure -text "Searching..."
848	    global topLevel
849	    table $topLevel .cancel_button 18,8 -anchor e -reqwidth .70i
850	    winop raise .cancel_button
851	    .quit_button configure -state disabled
852	    .clear_button configure -state disabled
853	    winop raise .cancel_button
854	    set pq_dict(lastFocus) [focus]
855            focus -force .
856	    set pq_dict(curBitmap) $pq_dict(lastBitmap)
857	    update
858	}
859	off {
860	    table forget .cancel_button
861	    .quit_button configure -state normal
862	    .clear_button configure -state normal
863	    .trademark configure -bitmap attlogo
864	    set pq_dict(lastBitmap) $pq_dict(curBitmap)
865	    set pq_dict(curBitmap) -1
866	    focus $pq_dict(lastFocus)
867	    busy release .
868	}
869    }
870    #
871    # Continue with next bitmap
872    #
873    if { $pq_dict(curBitmap) >= 0 } {
874	set bmap [format globe_%0.2d $pq_dict(curBitmap)]
875	.trademark configure -bitmap $bmap
876	incr pq_dict(curBitmap)
877	if { $pq_dict(curBitmap) >= 29 } {
878	    set pq_dict(curBitmap) 0
879	}
880	after 100 Animate continue
881    }
882}
883
884
885# --------------------------------------------------------------------------
886#
887# main body of program
888#
889frame .frame
890set topLevel .frame
891
892label .overall_label -font  -*-Helvetica-Bold-R-*-*-18-*-*-*-*-*-*-*
893label .name_label -font $pq_dict(titleFont)
894label .tel_label  -font $pq_dict(titleFont)
895label .addr_label -font $pq_dict(titleFont)
896label .org_title -font $pq_dict(titleFont)
897label .loc_title -font $pq_dict(titleFont)
898
899foreach name $pq_dict(entryNames) {
900    label .${name}_label
901    entry .${name}_entry
902}
903if [info exists env(POST_DEFAULTS)] {
904    set pq_dict(defaults) [split $env(POST_DEFAULTS) ":"]
905}
906foreach i $pq_dict(defaults) {
907    set i [split $i "="]
908    if { [llength $i] == 2 } {
909	set name [lindex $i 0]
910	if { [lsearch $pq_dict(entryNames) $name] >= 0 } {
911	    .${name}_entry insert 0 [lindex $i 1]
912	}
913    }
914}
915label .orders_title -text "Current Orders" \
916	-font  -*-Helvetica-Bold-R-*-*-16-*-*-*-*-*-*-*
917
918set font -*-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*
919button .clear_button -command ClearFields -font $font
920button .quit_button -command { exit }  -font $font
921button .search_button -text "Search" -font $font
922
923label .status_label
924button .cancel_button -command StopQuery
925#-relief raised
926label .trademark -bitmap attlogo
927text .text -yscrollcommand { .vscroll set } -state disabled
928scrollbar .vscroll -command { .text yview }
929
930table $topLevel \
931    .overall_label	0,1 -cspan 10 -pady 5 \
932    .name_label  	1,2 \
933    .last_entry  	2,2 -cspan 2 \
934    .first_entry 	2,4 \
935    .middle_entry 	2,5 \
936    .last_label 	3,2 \
937    .first_label 	3,4 \
938    .middle_label 	3,5 \
939    .tel_label 		1,7 \
940    .area_entry 	2,7 \
941    .exch_entry 	2,8 \
942    .ext_entry 		2,9 \
943    .area_label 	3,7 \
944    .exch_label  	3,8 \
945    .ext_label 		3,9 \
946    .org_title		4,2 \
947    .com_entry  	5,2 \
948    .org_entry 		5,3 \
949    .tl_entry 		5,4 \
950    .com_label 		6,2 \
951    .org_label 		6,3 \
952    .tl_label 		6,4 \
953    .loc_title		4,7 \
954    .room_entry 	5,7 \
955    .oldloc_entry 	5,8 \
956    .loc_entry 		5,9 \
957    .room_label 	6,7 \
958    .oldloc_label 	6,8 \
959    .loc_label 		6,9 \
960    .addr_label 	8,2 \
961    .street_entry       9,2 \
962    .ema_entry		9,7 -cspan 2  \
963    .street_label       10,2 \
964    .city_entry 	11,2 -cspan 2 \
965    .state_entry 	11,4 \
966    .zip_entry 		11,5 \
967    .ema_label       	10,7 -cspan 2 \
968    .city_label 	12,2 -cspan 2 \
969    .state_label 	12,4 \
970    .zip_label 		12,5 \
971    .orders_title       16,2  -pady { 4 0 } \
972    .text 		17,2 -cspan 8 -fill both -padx 2 \
973    .vscroll 		17,10 -anchor center -fill both \
974    .status_label	18,4 -cspan 6 -reqwidth {0 4i} \
975    .search_button      18,3 -reqwidth .9i -anchor center -pady 8\
976    .clear_button       18,5 -reqwidth .9i -anchor center \
977    .quit_button        18,8 -reqwidth .9i -anchor center
978
979eval table configure $topLevel \
980	[info command .*_label] [info commands .*_title] \
981	-anchor w -padx 2 -ipadx 2
982eval table configure $topLevel [info command .*_entry] \
983	-fill both -padx 2
984eval table configure $topLevel .name_label .tel_label .org_title \
985    .com_label .addr_label .street_entry .street_label \
986    -cspan 3
987eval table configure $topLevel .last_entry .ema_entry .city_entry \
988    .ema_label .city_label -cspan 2
989
990table configure $topLevel .overall_label -anchor center
991table configure $topLevel r16 -pady { 5 5 } -resize both
992table configure $topLevel c0 -width .vscroll
993table configure $topLevel c0 c10 -resize none
994table configure $topLevel r3 r6 r10 r12 -resize none
995table configure $topLevel r17 -height { 40 {} }
996table configure $topLevel r16 r18 -resize none
997table configure $topLevel c6 -pad { 5 5 }
998
999if { $topLevel == ".frame" } {
1000    table . \
1001	$topLevel 0,0 -fill both
1002}
1003
1004bind .text <Button-2> {
1005    FillFields %x %y
1006    continue
1007}
1008
1009bind .text <Motion> {
1010    HighlightText %x %y
1011    continue
1012}
1013
1014bind .text <Enter> {
1015    set pq_dict(textIndex) {}
1016    HighlightText %x %y
1017    set info [.text get [list 0.0 linestart] [list 0.0 lineend]]
1018    if { $info != "" } {
1019        .status_label configure -text "Query individual with button-2"
1020    }
1021    continue
1022}
1023
1024bind .text <Leave> {
1025    if { [busy isbusy .] != "." } {
1026	.text tag delete highlight
1027	.status_label configure -text ""
1028    }
1029    continue
1030}
1031
1032
1033bind EntryFocus <Tab> {
1034    ChangeFocus next
1035    break
1036}
1037
1038bind EntryFocus <Shift-Tab> {
1039    ChangeFocus last
1040    break
1041}
1042
1043if { $pq_dict(visual) == "color" } {
1044    bind EntryFocus <FocusIn> {
1045	ColorFocus %W on
1046    }
1047    bind EntryFocus <FocusOut> {
1048	ColorFocus %W off
1049    }
1050}
1051
1052bind Entry <Return> PostQuery
1053
1054foreach name $pq_dict(entryNames) {
1055    set w .${name}_entry
1056    bindtags $w [list EntryFocus $w Entry all]
1057}
1058
1059focus .last_entry
1060
1061