forked from patrickTingen/DataDigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dSorting.w
578 lines (459 loc) · 19.7 KB
/
dSorting.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
570
571
572
573
574
575
576
577
578
&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI
&ANALYZE-RESUME
&Scoped-define WINDOW-NAME CURRENT-WINDOW
&Scoped-define FRAME-NAME frSorting
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS frSorting
/*------------------------------------------------------------------------
File:
Description:
Input Parameters:
<none>
Output Parameters:
<none>
Author:
Created:
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AppBuilder. */
/*----------------------------------------------------------------------*/
/* *************************** Definitions ************************** */
{ datadigger.i }
/* Parameters Definitions --- */
DEFINE INPUT PARAMETER TABLE FOR ttColumn.
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttQuerySort.
DEFINE OUTPUT PARAMETER plSortChanged AS LOGICAL NO-UNDO.
DEFINE VARIABLE ghSortField AS HANDLE EXTENT 9 NO-UNDO.
DEFINE VARIABLE ghDescending AS HANDLE EXTENT 9 NO-UNDO.
/* _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 frSorting
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS btnOk Btn_Cancel btnClearAll cbSortField-1
&Scoped-Define DISPLAYED-OBJECTS tgDescending-1 cbSortField-2 ~
tgDescending-2 cbSortField-3 tgDescending-3 cbSortField-4 tgDescending-4 ~
cbSortField-5 tgDescending-5 cbSortField-6 tgDescending-6 cbSortField-7 ~
tgDescending-7 cbSortField-8 tgDescending-8 cbSortField-9 tgDescending-9 ~
cbSortField-1
/* 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 btnClearAll
LABEL "&Clear All"
SIZE-PIXELS 75 BY 24 TOOLTIP "clear all sorting".
DEFINE BUTTON btnOk
LABEL "OK"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE BUTTON Btn_Cancel AUTO-END-KEY
LABEL "Cancel"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE VARIABLE cbSortField-1 AS CHARACTER
LABEL "First sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-2 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-3 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-4 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-5 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-6 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-7 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-8 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE cbSortField-9 AS CHARACTER
LABEL "Then sort on"
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN AUTO-COMPLETION UNIQUE-MATCH
SIZE-PIXELS 160 BY 21 NO-UNDO.
DEFINE VARIABLE tgDescending-1 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-2 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-3 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-4 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-5 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-6 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-7 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-8 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
DEFINE VARIABLE tgDescending-9 AS LOGICAL INITIAL no
LABEL "&Descending"
VIEW-AS TOGGLE-BOX
SIZE-PIXELS 95 BY 17 NO-UNDO.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME frSorting
tgDescending-1 AT Y 10 X 269 WIDGET-ID 16
cbSortField-2 AT Y 36 X 80 COLON-ALIGNED WIDGET-ID 78
tgDescending-2 AT Y 36 X 269 WIDGET-ID 80
cbSortField-3 AT Y 61 X 80 COLON-ALIGNED WIDGET-ID 82
tgDescending-3 AT Y 61 X 269 WIDGET-ID 84
cbSortField-4 AT Y 86 X 80 COLON-ALIGNED WIDGET-ID 86
tgDescending-4 AT Y 86 X 269 WIDGET-ID 88
cbSortField-5 AT Y 111 X 80 COLON-ALIGNED WIDGET-ID 90
tgDescending-5 AT Y 111 X 269 WIDGET-ID 92
cbSortField-6 AT Y 136 X 80 COLON-ALIGNED WIDGET-ID 94
tgDescending-6 AT Y 136 X 269 WIDGET-ID 96
cbSortField-7 AT Y 161 X 80 COLON-ALIGNED WIDGET-ID 98
tgDescending-7 AT Y 161 X 269 WIDGET-ID 100
cbSortField-8 AT Y 186 X 80 COLON-ALIGNED WIDGET-ID 102
btnOk AT Y 185 X 405
tgDescending-8 AT Y 186 X 269 WIDGET-ID 104
cbSortField-9 AT Y 211 X 80 COLON-ALIGNED WIDGET-ID 106
tgDescending-9 AT Y 211 X 269 WIDGET-ID 108
Btn_Cancel AT Y 211 X 405
btnClearAll AT Y 100 X 405 WIDGET-ID 110
cbSortField-1 AT Y 10 X 80 COLON-ALIGNED WIDGET-ID 2
"ALT-S also opens this screen" VIEW-AS TEXT
SIZE-PIXELS 205 BY 18 AT Y 247 X 155 WIDGET-ID 112
FGCOLOR 7
WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
SIDE-LABELS NO-UNDERLINE THREE-D
SIZE-PIXELS 504 BY 300
TITLE "Set Sorting"
DEFAULT-BUTTON btnOk CANCEL-BUTTON Btn_Cancel 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 frSorting
FRAME-NAME */
ASSIGN
FRAME frSorting:SCROLLABLE = FALSE
FRAME frSorting:HIDDEN = TRUE.
/* SETTINGS FOR COMBO-BOX cbSortField-2 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-3 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-4 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-5 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-6 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-7 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-8 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR COMBO-BOX cbSortField-9 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-1 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-2 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-3 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-4 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-5 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-6 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-7 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-8 IN FRAME frSorting
NO-ENABLE */
/* SETTINGS FOR TOGGLE-BOX tgDescending-9 IN FRAME frSorting
NO-ENABLE */
/* _RUN-TIME-ATTRIBUTES-END */
&ANALYZE-RESUME
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME frSorting
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL frSorting frSorting
ON WINDOW-CLOSE OF FRAME frSorting /* Set Sorting */
DO:
APPLY "END-ERROR":U TO SELF.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnClearAll
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnClearAll frSorting
ON CHOOSE OF btnClearAll IN FRAME frSorting /* Clear All */
DO:
cbSortField-1:SCREEN-VALUE = ?.
APPLY 'value-changed' TO cbSortField-1.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnOk
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnOk frSorting
ON CHOOSE OF btnOk IN FRAME frSorting /* OK */
OR 'go' OF FRAME {&FRAME-NAME} ANYWHERE
DO:
DEFINE VARIABLE lContinue AS LOGICAL NO-UNDO.
RUN btnOkChoose(OUTPUT lContinue).
IF lContinue THEN APPLY 'GO' TO FRAME {&FRAME-NAME}.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME cbSortField-1
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cbSortField-1 frSorting
ON ALT-D OF cbSortField-1 IN FRAME frSorting /* First sort on */
, cbSortField-2, cbSortField-3, cbSortField-4, cbSortField-5, cbSortField-6, cbSortField-7, cbSortField-8, cbSortField-9
DO:
DEFINE VARIABLE iSelf AS INTEGER NO-UNDO.
iSelf = INTEGER(ENTRY(2,SELF:NAME,'-')).
IF ghDescending[iSelf]:SENSITIVE THEN
ghDescending[iSelf]:CHECKED = NOT ghDescending[iSelf]:CHECKED.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cbSortField-1 frSorting
ON RETURN OF cbSortField-1 IN FRAME frSorting /* First sort on */
, cbSortField-2, cbSortField-3, cbSortField-4, cbSortField-5, cbSortField-6, cbSortField-7, cbSortField-8, cbSortField-9
, tgDescending-1, tgDescending-2, tgDescending-3, tgDescending-4, tgDescending-5, tgDescending-6, tgDescending-7, tgDescending-8, tgDescending-9
DO:
DEFINE VARIABLE iSelf AS INTEGER NO-UNDO.
DEFINE VARIABLE lContinue AS LOGICAL NO-UNDO.
iSelf = INTEGER(ENTRY(2,SELF:NAME,'-')).
IF ghSortField[iSelf]:SCREEN-VALUE = ? THEN
DO:
RUN btnOkChoose(OUTPUT lContinue).
IF lContinue THEN APPLY 'GO' TO FRAME {&FRAME-NAME}.
END.
ELSE
IF iSelf < 9 THEN APPLY 'entry' TO ghSortField[iSelf + 1].
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cbSortField-1 frSorting
ON VALUE-CHANGED OF cbSortField-1 IN FRAME frSorting /* First sort on */
, cbSortField-2, cbSortField-3, cbSortField-4, cbSortField-5, cbSortField-6, cbSortField-7, cbSortField-8, cbSortField-9
DO:
DEFINE VARIABLE iSelf AS INTEGER NO-UNDO.
DEFINE VARIABLE iField AS INTEGER NO-UNDO.
iSelf = INTEGER(ENTRY(2,SELF:NAME,'-')).
IF SELF:SCREEN-VALUE = ? THEN
DO:
ghDescending[iSelf]:CHECKED = FALSE.
ghDescending[iSelf]:SENSITIVE = NO.
DO iField = iSelf + 1 TO 9:
ghSortField[iField]:SCREEN-VALUE = ?.
ghSortField[iField]:SENSITIVE = NO.
ghDescending[iField]:CHECKED = FALSE.
ghDescending[iField]:SENSITIVE = NO.
END.
END.
ELSE
DO:
ghDescending[iSelf]:SENSITIVE = YES.
IF iSelf < 9 THEN ghSortField[iSelf + 1]:SENSITIVE = YES.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&UNDEFINE SELF-NAME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK frSorting
/* *************************** 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:
/* Set default font */
FRAME {&FRAME-NAME}:FONT = getFont('Default').
RUN enable_UI.
RUN initializeObject.
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 btnOkChoose frSorting
PROCEDURE btnOkChoose :
/* Accept sort and go back
*/
DEFINE OUTPUT PARAMETER plContinue AS LOGICAL NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE BUFFER bfQuerySort FOR ttQuerySort.
/* fill tt with new sort */
FOR EACH bfQuerySort WHERE bfQuerySort.iGroup = 2:
DELETE bfQuerySort.
END.
DO i = 1 TO 9:
IF LOOKUP(ghSortField[i]:SCREEN-VALUE, ghSortField[i]:LIST-ITEMS) = 0 THEN
DO:
MESSAGE 'Sorting' i 'does not seem to be a valid field name' VIEW-AS ALERT-BOX INFO BUTTONS OK.
APPLY 'entry' TO ghSortField[i].
RETURN NO-APPLY.
END.
IF ghSortField[i]:SCREEN-VALUE <> ? THEN
DO:
CREATE bfQuerySort.
ASSIGN
bfQuerySort.iGroup = 2
bfQuerySort.iSortNr = i
bfQuerySort.cSortField = ghSortField[i]:SCREEN-VALUE
bfQuerySort.lAscending = NOT ghDescending[i]:CHECKED
.
/* Extract extent nr from name */
IF bfQuerySort.cSortField MATCHES '*[*]' THEN
bfQuerySort.iExt = INTEGER( ENTRY(1,ENTRY(2,bfQuerySort.cSortField,'['),']') ).
END.
END.
plSortChanged = TRUE.
plContinue = TRUE.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI frSorting _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 frSorting.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI frSorting _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.
------------------------------------------------------------------------------*/
DISPLAY tgDescending-1 cbSortField-2 tgDescending-2 cbSortField-3
tgDescending-3 cbSortField-4 tgDescending-4 cbSortField-5
tgDescending-5 cbSortField-6 tgDescending-6 cbSortField-7
tgDescending-7 cbSortField-8 tgDescending-8 cbSortField-9
tgDescending-9 cbSortField-1
WITH FRAME frSorting.
ENABLE btnOk Btn_Cancel btnClearAll cbSortField-1
WITH FRAME frSorting.
VIEW FRAME frSorting.
{&OPEN-BROWSERS-IN-QUERY-frSorting}
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initializeObject frSorting
PROCEDURE initializeObject :
/*
* Prepare widgets
*/
/*
DEFINE TEMP-TABLE ttQuerySort NO-UNDO RCODE-INFORMATION
FIELD iGroup AS INTEGER /* 1:query, 2:browse */
FIELD iSortNr AS INTEGER
FIELD cSortField AS CHARACTER
FIELD lAscending AS LOGICAL
INDEX iPrim IS PRIMARY iGroup iSortNr
*/
DEFINE VARIABLE cFields AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
FOR EACH ttColumn BY ttColumn.cFieldName:
cFields = cFields + ',' + ttColumn.cFullName.
END.
DO WITH FRAME {&FRAME-NAME}:
/* Grab handles of the fields for easier handling */
ghSortField[1] = cbSortField-1:HANDLE. ghDescending[1] = tgDescending-1:HANDLE.
ghSortField[2] = cbSortField-2:HANDLE. ghDescending[2] = tgDescending-2:HANDLE.
ghSortField[3] = cbSortField-3:HANDLE. ghDescending[3] = tgDescending-3:HANDLE.
ghSortField[4] = cbSortField-4:HANDLE. ghDescending[4] = tgDescending-4:HANDLE.
ghSortField[5] = cbSortField-5:HANDLE. ghDescending[5] = tgDescending-5:HANDLE.
ghSortField[6] = cbSortField-6:HANDLE. ghDescending[6] = tgDescending-6:HANDLE.
ghSortField[7] = cbSortField-7:HANDLE. ghDescending[7] = tgDescending-7:HANDLE.
ghSortField[8] = cbSortField-8:HANDLE. ghDescending[8] = tgDescending-8:HANDLE.
ghSortField[9] = cbSortField-9:HANDLE. ghDescending[9] = tgDescending-9:HANDLE.
/* Make a list of all fields */
DO i = 1 TO 9:
ghSortField[i]:LIST-ITEMS = cFields.
ghSortField[i]:SCREEN-VALUE = ?.
END.
/* fill combos with current sort */
FOR EACH ttQuerySort WHERE ttQuerySort.iGroup = 2 BY ttQuerySort.iSortNr:
ghSortField[ttQuerySort.iSortNr]:SCREEN-VALUE = ttQuerySort.cSortField.
ghDescending[ttQuerySort.iSortNr]:CHECKED = NOT ttQuerySort.lAscending.
END.
/* Set correct state */
DO i = 1 TO 9:
APPLY 'value-changed' TO ghSortField[i].
END.
END.
END PROCEDURE. /* initializeObject */
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME