forked from patrickTingen/DataDigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dChooseFont.w
569 lines (423 loc) · 16.8 KB
/
dChooseFont.w
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI
&ANALYZE-RESUME
&Scoped-define WINDOW-NAME CURRENT-WINDOW
&Scoped-define FRAME-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame
/*------------------------------------------------------------------------
File:
Description:
Input Parameters:
<none>
Output Parameters:
<none>
Author:
Created:
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AppBuilder. */
/*----------------------------------------------------------------------*/
/* *************************** Definitions ************************** */
/* Parameters Definitions --- */
{ datadigger.i }
/* Local Variable Definitions --- */
define {&invar} piFontOld as integer no-undo.
define {&outvar} piFontNew as integer no-undo initial -1.
define temp-table ttButton no-undo
field x as integer
field y as integer
field h as handle
.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE Dialog-Box
&Scoped-define DB-AWARE no
/* Name of designated FRAME-NAME and/or first browse and/or first query */
&Scoped-define FRAME-NAME Dialog-Frame
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS btn-0 btn-1 btn-2 btn-3 btn-4 btn-5 btn-6 ~
btn-7 btn-8 btn-9 btn-10 btn-11 btn-12 btn-13 btn-14 btn-15 btn-16 btn-17 ~
btn-18 btn-19 btn-20 btn-21 btn-22 btn-23 BtnCancel Btn_OK RECT-6 rcFocus
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME
/* *********************** Control Definitions ********************** */
/* Define a dialog box */
/* Definitions of the field level widgets */
DEFINE BUTTON btn-0
LABEL "Font 0"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-1
LABEL "Font 1"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-10
LABEL "Font 10"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-11
LABEL "Font 11"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-12
LABEL "Font 12"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-13
LABEL "Font 13"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-14
LABEL "Font 14"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-15
LABEL "Font 15"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-16
LABEL "Font 16"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-17
LABEL "Font 17"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-18
LABEL "Font 18"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit"
FONT 18.
DEFINE BUTTON btn-19
LABEL "Font 19"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-2
LABEL "Font 2"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-20
LABEL "Font 20"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-21
LABEL "Font 21"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-22
LABEL "Font 22"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-23
LABEL "Font 23"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-3
LABEL "Font 3"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-4
LABEL "Font 4"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-5
LABEL "Font 5"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-6
LABEL "Font 6"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-7
LABEL "Font 7"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-8
LABEL "Font 8"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON btn-9
LABEL "Font 9"
SIZE-PIXELS 200 BY 42 TOOLTIP "Double click font to edit".
DEFINE BUTTON BtnCancel AUTO-END-KEY DEFAULT
LABEL "Cancel"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE BUTTON Btn_OK AUTO-GO
LABEL "OK"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE RECTANGLE rcFocus
EDGE-PIXELS 2 GRAPHIC-EDGE
SIZE-PIXELS 30 BY 20
BGCOLOR 9 .
DEFINE RECTANGLE RECT-6
EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
SIZE-PIXELS 830 BY 305.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME Dialog-Frame
btn-0 AT Y 10 X 5 WIDGET-ID 10
btn-1 AT Y 10 X 210 WIDGET-ID 2
btn-2 AT Y 10 X 415 WIDGET-ID 4
btn-3 AT Y 10 X 620 WIDGET-ID 8
btn-4 AT Y 60 X 5 WIDGET-ID 6
btn-5 AT Y 60 X 210 WIDGET-ID 12
btn-6 AT Y 60 X 415 WIDGET-ID 14
btn-7 AT Y 60 X 620 WIDGET-ID 16
btn-8 AT Y 110 X 5 WIDGET-ID 18
btn-9 AT Y 110 X 210 WIDGET-ID 20
btn-10 AT Y 110 X 415 WIDGET-ID 22
btn-11 AT Y 110 X 620 WIDGET-ID 24
btn-12 AT Y 160 X 5 WIDGET-ID 26
btn-13 AT Y 160 X 210 WIDGET-ID 28
btn-14 AT Y 160 X 415 WIDGET-ID 30
btn-15 AT Y 160 X 620 WIDGET-ID 32
btn-16 AT Y 210 X 5 WIDGET-ID 34
btn-17 AT Y 210 X 210 WIDGET-ID 36
btn-18 AT Y 210 X 415 WIDGET-ID 38
btn-19 AT Y 210 X 620 WIDGET-ID 40
btn-20 AT Y 260 X 5 WIDGET-ID 42
btn-21 AT Y 260 X 210 WIDGET-ID 44
btn-22 AT Y 260 X 415 WIDGET-ID 46
btn-23 AT Y 260 X 620 WIDGET-ID 48
BtnCancel AT Y 325 X 660 WIDGET-ID 54
Btn_OK AT Y 325 X 740
"Double click font to edit" VIEW-AS TEXT
SIZE-PIXELS 125 BY 13 AT Y 320 X 10 WIDGET-ID 56
RECT-6 AT Y 5 X 0 WIDGET-ID 50
rcFocus AT Y 315 X 150 WIDGET-ID 52
WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
SIDE-LABELS NO-UNDERLINE THREE-D
SIZE-PIXELS 847 BY 388
TITLE "Choose Font"
DEFAULT-BUTTON Btn_OK CANCEL-BUTTON BtnCancel WIDGET-ID 100.
/* *********************** Procedure Settings ************************ */
&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
Type: Dialog-Box
Allow: Basic,Browse,DB-Fields,Query
Other Settings: COMPILE
*/
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS
/* *********** Runtime Attributes and AppBuilder Settings *********** */
&ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
/* SETTINGS FOR DIALOG-BOX Dialog-Frame
FRAME-NAME Custom */
ASSIGN
FRAME Dialog-Frame:SCROLLABLE = FALSE
FRAME Dialog-Frame:HIDDEN = TRUE.
ASSIGN
rcFocus:HIDDEN IN FRAME Dialog-Frame = TRUE.
/* _RUN-TIME-ATTRIBUTES-END */
&ANALYZE-RESUME
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON WINDOW-CLOSE OF FRAME Dialog-Frame /* Choose Font */
DO:
piFontNew = -1.
APPLY "END-ERROR":U TO SELF.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btn-0
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON CURSOR-DOWN OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
define variable hTarget as handle no-undo.
define buffer bButton for ttButton.
for each bButton
where bButton.x = self:x
and bButton.y > self:y
by bButton.y:
hTarget = bButton.h.
leave.
end.
if valid-handle(hTarget) then
apply 'entry' to hTarget.
return no-apply.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON CURSOR-LEFT OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
define variable hTarget as handle no-undo.
define buffer bButton for ttButton.
for each bButton
where bButton.y = self:y
and bButton.x < self:x
by bButton.x descending:
hTarget = bButton.h.
leave.
end.
if valid-handle(hTarget) then
apply 'entry' to hTarget.
return no-apply.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON CURSOR-RIGHT OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
define variable hTarget as handle no-undo.
define buffer bButton for ttButton.
for each bButton
where bButton.y = self:y
and bButton.x > self:x
by bButton.x:
hTarget = bButton.h.
leave.
end.
if valid-handle(hTarget) then
apply 'entry' to hTarget.
return no-apply.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON CURSOR-UP OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
define variable hTarget as handle no-undo.
define buffer bButton for ttButton.
for each bButton
where bButton.x = self:x
and bButton.y < self:y
by bButton.y descending:
hTarget = bButton.h.
leave.
end.
if valid-handle(hTarget) then
apply 'entry' to hTarget.
return no-apply.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON ENTRY OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
rcFocus:x = self:x - 3.
rcFocus:y = self:y - 3.
rcFocus:width-pixels = self:width-pixels + 6.
rcFocus:height-pixels = self:height-pixels + 6.
rcFocus:hidden = no.
piFontNew = integer(entry(2,self:name,'-')).
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON LEAVE OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
rcFocus:hidden = yes.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-0 Dialog-Frame
ON MOUSE-SELECT-DBLCLICK OF btn-0 IN FRAME Dialog-Frame /* Font 0 */
, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
or 'RETURN' of btn-0, btn-1, btn-2, btn-3, btn-4, btn-5, btn-6, btn-7, btn-8, btn-9, btn-10, btn-11, btn-12
, btn-13, btn-14, btn-15, btn-16, btn-17, btn-18, btn-19, btn-20, btn-21, btn-22, btn-23
DO:
define variable iFontNr as integer no-undo.
iFontNr = integer(entry(2,self:name,'-')).
system-dialog font iFontNr.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME BtnCancel
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BtnCancel Dialog-Frame
ON CHOOSE OF BtnCancel IN FRAME Dialog-Frame /* Cancel */
DO:
piFontNew = -1.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&UNDEFINE SELF-NAME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Dialog-Frame
/* *************************** Main Block *************************** */
/* Parent the dialog-box to the ACTIVE-WINDOW, if there is no parent. */
IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ?
THEN FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.
/* Now enable the interface and wait for the exit condition. */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire. */
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
run enable_UI.
run initializeObjects.
WAIT-FOR GO OF FRAME {&FRAME-NAME}.
END.
RUN disable_UI.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
/* ********************** Internal Procedures *********************** */
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI Dialog-Frame _DEFAULT-DISABLE
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
Purpose: DISABLE the User Interface
Parameters: <none>
Notes: Here we clean-up the user-interface by deleting
dynamic widgets we have created and/or hide
frames. This procedure is usually called when
we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
/* Hide all frames. */
HIDE FRAME Dialog-Frame.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI Dialog-Frame _DEFAULT-ENABLE
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
Purpose: ENABLE the User Interface
Parameters: <none>
Notes: Here we display/view/enable the widgets in the
user-interface. In addition, OPEN all queries
associated with each FRAME and BROWSE.
These statements here are based on the "Other
Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
ENABLE btn-0 btn-1 btn-2 btn-3 btn-4 btn-5 btn-6 btn-7 btn-8 btn-9 btn-10
btn-11 btn-12 btn-13 btn-14 btn-15 btn-16 btn-17 btn-18 btn-19 btn-20
btn-21 btn-22 btn-23 BtnCancel Btn_OK RECT-6 rcFocus
WITH FRAME Dialog-Frame.
VIEW FRAME Dialog-Frame.
{&OPEN-BROWSERS-IN-QUERY-Dialog-Frame}
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initializeObjects Dialog-Frame
PROCEDURE initializeObjects :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
define variable iButtonNr as integer no-undo.
define variable hButton as handle no-undo.
define variable cFontName as character no-undo.
/* Get fonts */
frame {&frame-name}:font = getFont('Default').
hButton = frame {&frame-name}:first-child:first-child. /* rectangle */
repeat:
hButton = hButton:next-sibling.
if not valid-handle(hButton) then leave.
if not valid-handle(hButton) then next.
if not hButton:name matches 'btn-*' then next.
iButtonNr = integer(entry(2,hButton:name,'-')).
hButton:font = iButtonNr. /* Font is same as name of button */
/* Get the name of the font from the progress.ini */
get-key-value section 'fonts'
key 'font' + string(iButtonNr)
value cFontName.
if cFontName <> ? then
hButton:label = substitute('&1: &2', iButtonNr, cFontName).
/* If this is the one that is specified in the input param
* then set focus on this one by applying ENTRY.
*/
if hButton:name = substitute('btn-&1', piFontOld) then
apply 'entry' to hButton.
/* Save button props */
create ttButton.
assign ttButton.x = hButton:x
ttButton.y = hButton:y
ttButton.h = hButton
.
end.
/* For some reasons, these #*$&# scrollbars keep coming back */
run showScrollBars(frame {&frame-name}:handle, no, no). /* KILL KILL KILL */
end procedure. /* initializeObjects */
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME