-
Notifications
You must be signed in to change notification settings - Fork 24
/
dEditGroup.w
627 lines (472 loc) · 19.1 KB
/
dEditGroup.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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI
&ANALYZE-RESUME
/* Connected Databases
*/
&Scoped-define WINDOW-NAME CURRENT-WINDOW
&Scoped-define FRAME-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame
/*------------------------------------------------------------------------
Name: dEditGroup.w
Desc: Edit a group of favourite tables
----------------------------------------------------------------------*/
/* This .W file was created with the Progress AppBuilder. */
/*----------------------------------------------------------------------*/
{ DataDigger.i }
&IF DEFINED(UIB_IS_RUNNING) = 0 &THEN
DEFINE INPUT-OUTPUT PARAMETER pcGroup AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttTable.
DEFINE OUTPUT PARAMETER plOk AS LOGICAL NO-UNDO.
&ELSE
DEFINE VARIABLE pcGroup AS CHARACTER NO-UNDO INITIAL 'myFavourites'.
DEFINE VARIABLE hLib AS HANDLE NO-UNDO.
DEFINE VARIABLE plOk AS LOGICAL NO-UNDO.
RUN datadiggerlib.p PERSISTENT SET hLib.
THIS-PROCEDURE:ADD-SUPER-PROCEDURE(hLib,SEARCH-TARGET).
RUN fillTT.
&ENDIF
DEFINE VARIABLE gcFavouriteTables AS CHARACTER 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 Dialog-Frame
&Scoped-define BROWSE-NAME brTables
/* Internal Tables (found by Frame, Query & Browse Queries) */
&Scoped-define INTERNAL-TABLES ttTable
/* Definitions for BROWSE brTables */
&Scoped-define FIELDS-IN-QUERY-brTables ttTable.lFavourite ttTable.cTableName ttTable.cDatabase
&Scoped-define ENABLED-FIELDS-IN-QUERY-brTables
&Scoped-define SELF-NAME brTables
&Scoped-define QUERY-STRING-brTables FOR EACH ttTable WHERE ttTable.cTableName MATCHES '*' + fiTableFilter:SCREEN-VALUE + '*' AND (cbDatabase:SCREEN-VALUE = ? OR ttTable.cDatabase = cbDatabase:SCREEN-VALUE) AND (ttTable.lShowInList = TRUE OR ttTable.lFavourite = TRUE)
&Scoped-define OPEN-QUERY-brTables OPEN QUERY {&SELF-NAME} FOR EACH ttTable WHERE ttTable.cTableName MATCHES '*' + fiTableFilter:SCREEN-VALUE + '*' AND (cbDatabase:SCREEN-VALUE = ? OR ttTable.cDatabase = cbDatabase:SCREEN-VALUE) AND (ttTable.lShowInList = TRUE OR ttTable.lFavourite = TRUE).
&Scoped-define TABLES-IN-QUERY-brTables ttTable
&Scoped-define FIRST-TABLE-IN-QUERY-brTables ttTable
/* Definitions for DIALOG-BOX Dialog-Frame */
&Scoped-define OPEN-BROWSERS-IN-QUERY-Dialog-Frame ~
~{&OPEN-QUERY-brTables}
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS BtnCancel btnDelete btnEdit fiGroupname ~
fiTableFilter cbDatabase brTables btnSelectAll btnDeselectAll Btn_OK
&Scoped-Define DISPLAYED-OBJECTS fiGroupname fiTableFilter cbDatabase
/* 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 BtnCancel AUTO-END-KEY DEFAULT
LABEL "Cancel"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE BUTTON btnDelete NO-FOCUS FLAT-BUTTON
LABEL "del"
SIZE-PIXELS 20 BY 21 TOOLTIP "delete this group".
DEFINE BUTTON btnDeselectAll
LABEL "&Deselect all"
SIZE-PIXELS 75 BY 24 TOOLTIP "deselect all tables currently in the browse"
BGCOLOR 8 .
DEFINE BUTTON btnEdit NO-FOCUS FLAT-BUTTON
LABEL "edit"
SIZE-PIXELS 20 BY 21 TOOLTIP "edit the name of the group".
DEFINE BUTTON btnSelectAll
LABEL "Select &all"
SIZE-PIXELS 75 BY 24 TOOLTIP "select all tables currently in the browse"
BGCOLOR 8 .
DEFINE BUTTON Btn_OK AUTO-GO
LABEL "OK"
SIZE-PIXELS 75 BY 24
BGCOLOR 8 .
DEFINE VARIABLE cbDatabase AS CHARACTER FORMAT "X(256)":U
VIEW-AS COMBO-BOX INNER-LINES 10
LIST-ITEMS "Item 1"
DROP-DOWN-LIST
SIZE-PIXELS 125 BY 21 NO-UNDO.
DEFINE VARIABLE fiGroupname AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE-PIXELS 290 BY 21 NO-UNDO.
DEFINE VARIABLE fiTableFilter AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE-PIXELS 185 BY 21 TOOLTIP "filter the list of tables" NO-UNDO.
/* Query definitions */
&ANALYZE-SUSPEND
DEFINE QUERY brTables FOR
ttTable SCROLLING.
&ANALYZE-RESUME
/* Browse definitions */
DEFINE BROWSE brTables
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS brTables Dialog-Frame _FREEFORM
QUERY brTables DISPLAY
ttTable.lFavourite COLUMN-LABEL "" VIEW-AS TOGGLE-BOX
ttTable.cTableName COLUMN-LABEL "Table"
ttTable.cDatabase COLUMN-LABEL "DB"
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
WITH NO-ROW-MARKERS SEPARATORS
&IF '{&WINDOW-SYSTEM}' = 'TTY':U &THEN SIZE 62 BY 12
&ELSE SIZE-PIXELS 310 BY 255 &ENDIF FIT-LAST-COLUMN.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME Dialog-Frame
BtnCancel AT Y 270 X 330
btnDelete AT Y 5 X 385
btnEdit AT Y 5 X 295
fiGroupname AT Y 5 X 5 NO-LABEL
fiTableFilter AT Y 47 X 5 NO-LABEL
cbDatabase AT Y 47 X 180 COLON-ALIGNED NO-LABEL
brTables AT Y 70 X 5
btnSelectAll AT Y 137 X 330
btnDeselectAll AT Y 172 X 330
Btn_OK AT Y 300 X 330
WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
SIDE-LABELS NO-UNDERLINE THREE-D
SIZE-PIXELS 424 BY 366
TITLE "Edit favourites group"
DEFAULT-BUTTON Btn_OK CANCEL-BUTTON BtnCancel.
/* *********************** 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 */
/* BROWSE-TAB brTables cbDatabase Dialog-Frame */
ASSIGN
FRAME Dialog-Frame:SCROLLABLE = FALSE
FRAME Dialog-Frame:HIDDEN = TRUE.
/* SETTINGS FOR FILL-IN fiGroupname IN FRAME Dialog-Frame
ALIGN-L */
ASSIGN
fiGroupname:READ-ONLY IN FRAME Dialog-Frame = TRUE.
/* SETTINGS FOR FILL-IN fiTableFilter IN FRAME Dialog-Frame
ALIGN-L */
/* _RUN-TIME-ATTRIBUTES-END */
&ANALYZE-RESUME
/* Setting information for Queries and Browse Widgets fields */
&ANALYZE-SUSPEND _QUERY-BLOCK BROWSE brTables
/* Query rebuild information for BROWSE brTables
_START_FREEFORM
OPEN QUERY {&SELF-NAME}
FOR EACH ttTable
WHERE ttTable.cTableName MATCHES '*' + fiTableFilter:SCREEN-VALUE + '*'
AND (cbDatabase:SCREEN-VALUE = ? OR ttTable.cDatabase = cbDatabase:SCREEN-VALUE)
AND (ttTable.lShowInList = TRUE OR ttTable.lFavourite = TRUE).
_END_FREEFORM
_Query is OPENED
*/ /* BROWSE brTables */
&ANALYZE-RESUME
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON ALT-T OF FRAME Dialog-Frame /* Edit favourites group */
DO:
APPLY 'ENTRY' TO fiTableFilter.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON ENDKEY OF FRAME Dialog-Frame /* Edit favourites group */
DO:
DEFINE BUFFER bTable FOR ttTable.
FOR EACH bTable:
bTable.lFavourite = CAN-DO(gcFavouriteTables, bTable.cTableName).
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON GO OF FRAME Dialog-Frame /* Edit favourites group */
DO:
DEFINE VARIABLE lMerge AS LOGICAL NO-UNDO.
DEFINE VARIABLE cNewName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cOldName AS CHARACTER NO-UNDO.
DEFINE BUFFER bTable FOR ttTable.
/* Changing the name of the group might cause a conflict */
IF pcGroup <> fiGroupname:SCREEN-VALUE
AND getRegistry('DataDigger:Favourites', fiGroupname:SCREEN-VALUE) <> ? THEN
DO:
MESSAGE 'There is another group with this name.' SKIP 'Do you want to merge them?'
VIEW-AS ALERT-BOX INFORMATION BUTTONS YES-NO-CANCEL UPDATE lMerge.
IF lMerge <> YES THEN RETURN NO-APPLY.
END.
cOldName = pcGroup.
cNewName = fiGroupname:SCREEN-VALUE.
FOR EACH bTable:
/* Changed fav status */
IF bTable.lFavourite <> CAN-DO(gcFavouriteTables, bTable.cTableName) THEN
RUN setFavourite(bTable.cTableName, pcGroup, bTable.lFavourite).
/* Changed group name */
IF bTable.lFavourite AND cOldName <> cNewName THEN
DO:
/* Remove from old group and add to new one */
RUN setFavourite(bTable.cTableName, cOldName, NO).
RUN setFavourite(bTable.cTableName, cNewName, YES).
END.
END.
pcGroup = cNewName.
plOk = TRUE.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON WINDOW-CLOSE OF FRAME Dialog-Frame /* Edit favourites group */
DO:
APPLY "END-ERROR":U TO SELF.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define BROWSE-NAME brTables
&Scoped-define SELF-NAME brTables
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL brTables Dialog-Frame
ON DEFAULT-ACTION OF brTables IN FRAME Dialog-Frame
OR ' ' OF brTables
OR 'RETURN' OF brTables
DO:
ttTable.lFavourite = NOT ttTable.lFavourite.
BROWSE brTables:REFRESH().
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL brTables Dialog-Frame
ON MOUSE-SELECT-CLICK OF brTables IN FRAME Dialog-Frame
DO:
/* Alternative way for toggling the selection box
* If we just enable it, focus comes solely on the
* toggle box when we jump from filterbox to browse
*/
DEFINE VARIABLE iMouseX AS INTEGER NO-UNDO.
DEFINE VARIABLE iMouseY AS INTEGER NO-UNDO.
DEFINE VARIABLE iRow AS INTEGER NO-UNDO.
DEFINE VARIABLE hBrowse AS HANDLE NO-UNDO.
DO WITH FRAME {&FRAME-NAME}:
hBrowse = BROWSE brTables:HANDLE.
RUN getMouseXY(INPUT hBrowse:FRAME, OUTPUT iMouseX, OUTPUT iMouseY).
IF iMouseY > hBrowse:Y
AND iMouseY < hBrowse:Y + hBrowse:HEIGHT-PIXELS
AND iMouseX > hBrowse:X
AND iMouseX < (hBrowse:X + hBrowse:GET-BROWSE-COLUMN(2):X) THEN
DO:
{&_proparse_ prolint-nowarn(overflow)}
iRow = TRUNCATE((iMouseY - brTables:Y) / (hBrowse:ROW-HEIGHT-PIXELS + 4),0).
IF hBrowse:NUM-ITERATIONS > 0 AND iRow > hBrowse:NUM-ITERATIONS THEN RETURN.
IF iRow < 1 THEN RETURN.
/* Get the record in the buffer */
IF hBrowse:QUERY:NUM-RESULTS > 0 THEN
DO:
hBrowse:SELECT-ROW(iRow).
hBrowse:FETCH-SELECTED-ROW(1).
APPLY 'default-action' TO hBrowse.
END.
END.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL brTables Dialog-Frame
ON OFF-HOME OF brTables IN FRAME Dialog-Frame
DO:
APPLY 'ENTRY' TO fiTableFilter.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnDelete
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnDelete Dialog-Frame
ON CHOOSE OF btnDelete IN FRAME Dialog-Frame /* del */
DO:
DEFINE VARIABLE lDelete AS LOGICAL NO-UNDO.
DEFINE BUFFER bTable FOR ttTable.
MESSAGE 'Are you sure you want to delete this group?'
VIEW-AS ALERT-BOX INFORMATION BUTTONS YES-NO-CANCEL UPDATE lDelete.
IF lDelete THEN
DO:
FOR EACH bTable:
bTable.lFavourite = NO.
END.
APPLY 'go' TO FRAME {&FRAME-NAME}.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnDeselectAll
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnDeselectAll Dialog-Frame
ON CHOOSE OF btnDeselectAll IN FRAME Dialog-Frame /* Deselect all */
OR 'CTRL-D' OF brTables
DO:
RUN selectTables(fiTableFilter:SCREEN-VALUE, NO).
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnEdit
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnEdit Dialog-Frame
ON CHOOSE OF btnEdit IN FRAME Dialog-Frame /* edit */
OR mouse-select-click OF fiGroupname
DO:
fiGroupname:PRIVATE-DATA = fiGroupname:SCREEN-VALUE.
fiGroupname:READ-ONLY = FALSE.
APPLY 'ENTRY' TO fiGroupname.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnSelectAll
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnSelectAll Dialog-Frame
ON CHOOSE OF btnSelectAll IN FRAME Dialog-Frame /* Select all */
OR 'CTRL-A' OF brTables
DO:
RUN selectTables(fiTableFilter:SCREEN-VALUE, YES).
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fiGroupname
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fiGroupname Dialog-Frame
ON RETURN OF fiGroupname IN FRAME Dialog-Frame
DO:
SELF:CLEAR-SELECTION().
fiGroupname:READ-ONLY = TRUE.
APPLY 'entry' TO fiTableFilter.
RETURN NO-APPLY.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fiTableFilter
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fiTableFilter Dialog-Frame
ON CURSOR-DOWN OF fiTableFilter IN FRAME Dialog-Frame
DO:
APPLY 'ENTRY' to brTables.
RETURN NO-APPLY.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fiTableFilter Dialog-Frame
ON VALUE-CHANGED OF fiTableFilter IN FRAME Dialog-Frame
, cbDatabase
DO:
{&open-query-brTables}
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 initObject.
WAIT-FOR GO OF FRAME {&FRAME-NAME} FOCUS fiTableFilter.
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.
------------------------------------------------------------------------------*/
DISPLAY fiGroupname fiTableFilter cbDatabase
WITH FRAME Dialog-Frame.
ENABLE BtnCancel btnDelete btnEdit fiGroupname fiTableFilter cbDatabase
brTables btnSelectAll btnDeselectAll Btn_OK
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 fillTT Dialog-Frame
PROCEDURE fillTT :
/* Fill the tt for testing in the UIB
*/
DEFINE BUFFER bTable FOR ttTable.
DEFINE BUFFER bTableFilter FOR ttTableFilter.
RUN getTables(INPUT TABLE bTableFilter, OUTPUT TABLE bTable).
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initObject Dialog-Frame
PROCEDURE initObject :
/* Init
*/
DEFINE BUFFER bTable FOR ttTable.
DO WITH FRAME {&FRAME-NAME}:
/* Set databases */
cbDatabase:LIST-ITEMS = ',' + getDatabaseList().
cbDatabase:SCREEN-VALUE = getRegistry('DataDigger','Database') NO-ERROR.
btnEdit:LOAD-IMAGE(getImagePath('edit.gif')).
btnDelete:LOAD-IMAGE(getImagePath('delete.gif')).
fiGroupName = pcGroup.
RUN enable_UI.
FOR EACH bTable WHERE bTable.lFavourite = TRUE:
gcFavouriteTables = TRIM(gcFavouriteTables + ',' + bTable.cTableName,',').
END.
END.
END PROCEDURE. /* initObject */
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE selectTables Dialog-Frame
PROCEDURE selectTables :
/* Select all or none of the tables
*/
DEFINE INPUT PARAMETER pcFilter AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER plSelect AS LOGICAL NO-UNDO.
DEFINE VARIABLE rTable AS ROWID NO-UNDO.
DEFINE VARIABLE iBrowseRow AS INTEGER NO-UNDO.
DEFINE BUFFER bTable FOR ttTable.
DO WITH FRAME {&FRAME-NAME}:
IF AVAILABLE ttTable THEN
DO:
rTable = ROWID(ttTable).
/* Position in browse */
#FindRow:
DO iBrowseRow = 1 TO brTables:NUM-ENTRIES:
IF brTables:IS-ROW-SELECTED(iBrowseRow) THEN LEAVE #FindRow.
END.
END.
FOR EACH bTable
WHERE bTable.cTableName MATCHES '*' + pcFilter + '*'
AND (cbDatabase:SCREEN-VALUE = ? OR bTable.cDatabase = cbDatabase:SCREEN-VALUE)
AND (bTable.lShowInList = TRUE OR bTable.lFavourite = TRUE):
bTable.lFavourite = plSelect.
END.
{&open-query-brTables}
IF rTable <> ? THEN
DO:
IF iBrowseRow > 0 THEN brTables:SET-REPOSITIONED-ROW(iBrowseRow,"CONDITIONAL") .
brTables:QUERY:REPOSITION-TO-ROWID(rTable).
END.
END.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME