1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS B-table-Win
8 /*------------------------------------------------------------------------
12 Description
: from BROWSER.W
- Basic SmartBrowser Object Template
20 ------------------------------------------------------------------------*/
21 /* This .W file was created with the Progress UIB.
*/
22 /*----------------------------------------------------------------------*/
24 /* Create an unnamed pool to store all the widgets created
25 by this procedure. This is a good default which assures
26 that this procedure's triggers and internal procedures
27 will execute in this procedure's storage
, and that proper
28 cleanup will occur on deletion of the procedure.
*/
32 /* *************************** Definitions
************************** */
34 /* Parameters Definitions
--- */
36 /* Local Variable Definitions
--- */
38 {inc
/topic
/tpnewbch.i
}
40 DEF VAR PersonName
AS CHAR FORMAT "X(20)" LABEL "Operator" NO-UNDO.
41 DEF VAR gap-1
AS CHAR NO-UNDO FORMAT "X" LABEL "".
42 DEF VAR gap-2
AS CHAR NO-UNDO FORMAT "X" LABEL "".
44 /* _UIB-CODE-BLOCK-END
*/
48 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
50 /* ******************** Preprocessor Definitions
******************** */
52 &Scoped-define PROCEDURE-TYPE SmartBrowser
54 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
56 /* Name of first Frame and
/or Browse and
/or first Query
*/
57 &Scoped-define FRAME-NAME F-Main
58 &Scoped-define BROWSE-NAME br_table
60 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
61 &Scoped-define INTERNAL-TABLES NewBatch Person
63 /* Define KEY-PHRASE in case it is used by any query.
*/
64 &Scoped-define KEY-PHRASE TRUE
66 /* Definitions for
BROWSE br_table
*/
67 &Scoped-define FIELDS-IN-QUERY-br_table NewBatch.BatchCode gap-1 @ gap-1 ~
68 NewBatch.Description NewBatch.DocumentCount NewBatch.Total gap-2 @ gap-2 ~
69 Person.FirstName
+ ' '
+ Person.LastName @ PersonName
70 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
71 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
72 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH NewBatch WHERE ~{&KEY-PHRASE} NO-LOCK, ~
73 EACH Person
OF NewBatch
OUTER-JOIN NO-LOCK ~
74 BY NewBatch.BatchCode
DESCENDING.
75 &Scoped-define TABLES-IN-QUERY-br_table NewBatch Person
76 &Scoped-define FIRST-TABLE-IN-QUERY-br_table NewBatch
79 /* Definitions for
FRAME F-Main
*/
81 /* Standard List Definitions
*/
82 &Scoped-Define ENABLED-OBJECTS br_table
84 /* Custom List Definitions
*/
85 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
87 /* _UIB-PREPROCESSOR-BLOCK-END
*/
91 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
92 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
98 BatchType|y|y|TTPL.NewBatch.BatchType
99 BatchCode||y|TTPL.NewBatch.BatchCode
100 PersonCode||y|TTPL.NewBatch.PersonCode
103 **************************
104 * Set attributes related to FOREIGN
KEYS
106 RUN set-attribute-list
(
107 'Keys-Accepted
= "BatchType",
108 Keys-Supplied
= "BatchType,BatchCode,PersonCode"'
:U
).
110 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
111 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
112 /**************************
114 /* _UIB-CODE-BLOCK-END
*/
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
118 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
126 ************************
127 * Set attributes related to SORTBY-OPTIONS
*/
128 RUN set-attribute-list
(
129 'SortBy-Options
= ""'
:U
).
130 /************************
133 </FILTER-ATTRIBUTES
> */
135 /* _UIB-CODE-BLOCK-END
*/
139 /* *********************** Control Definitions
********************** */
142 /* Definitions of the field level widgets
*/
143 /* Query definitions
*/
145 DEFINE QUERY br_table
FOR
150 /* Browse definitions
*/
151 DEFINE BROWSE br_table
152 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
153 QUERY br_table
NO-LOCK DISPLAY
157 NewBatch.DocumentCount
160 Person.FirstName
+ ' '
+ Person.LastName @ PersonName
161 /* _UIB-CODE-BLOCK-END
*/
163 WITH NO-ASSIGN NO-ROW-MARKERS SEPARATORS SIZE 82.29 BY 14
167 /* ************************ Frame Definitions
*********************** */
170 br_table
AT ROW 1 COL 1
171 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
172 SIDE-LABELS NO-UNDERLINE THREE-D
173 AT COL 1 ROW 1 SCROLLABLE
177 /* *********************** Procedure Settings
************************ */
179 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
180 /* Settings for
THIS-PROCEDURE
184 Add Fields to
: EXTERNAL-TABLES
185 Other Settings
: PERSISTENT-ONLY
COMPILE
188 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
189 /* then cleanup and return.
*/
190 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
191 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
192 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
196 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
198 /* ************************* Create Window
************************** */
200 &ANALYZE-SUSPEND _CREATE-WINDOW
201 /* DESIGN Window definition
(used by the UIB
)
202 CREATE WINDOW B-table-Win
ASSIGN
205 /* END WINDOW DEFINITION
*/
210 /* *************** Runtime Attributes and UIB Settings
************** */
212 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
213 /* SETTINGS
FOR WINDOW B-table-Win
214 NOT-VISIBLE
,,RUN-PERSISTENT
*/
215 /* SETTINGS
FOR FRAME F-Main
216 NOT-VISIBLE Size-to-Fit
*/
217 /* BROWSE-TAB br_table
1 F-Main
*/
219 FRAME F-Main
:SCROLLABLE = FALSE
220 FRAME F-Main
:HIDDEN = TRUE.
222 /* _RUN-TIME-ATTRIBUTES-END
*/
226 /* Setting information for Queries and Browse Widgets fields
*/
228 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
229 /* Query rebuild information for
BROWSE br_table
230 _TblList
= "TTPL.NewBatch,TTPL.Person OF TTPL.NewBatch"
231 _Options
= "NO-LOCK KEY-PHRASE"
232 _TblOptList
= ", OUTER"
233 _OrdList
= "TTPL.NewBatch.BatchCode|no"
234 _FldNameList
[1] = TTPL.NewBatch.BatchCode
235 _FldNameList
[2] > "_<CALC>"
236 "gap-1 @ gap-1" ? ? ? ? ? ? ? ? ? no ?
237 _FldNameList
[3] = TTPL.NewBatch.Description
238 _FldNameList
[4] = TTPL.NewBatch.DocumentCount
239 _FldNameList
[5] = TTPL.NewBatch.Total
240 _FldNameList
[6] > "_<CALC>"
241 "gap-2 @ gap-2" ? ? ? ? ? ? ? ? ? no ?
242 _FldNameList
[7] > "_<CALC>"
243 "Person.FirstName + ' ' + Person.LastName @ PersonName" ? ? ? ? ? ? ? ? ? no ?
245 */ /* BROWSE br_table
*/
248 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
249 /* Query rebuild information for
FRAME F-Main
252 */ /* FRAME F-Main
*/
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "SmartBrowserWizard" B-table-Win _INLINE
258 /* Actions
: adm
/support
/_wizard.w ? ? ? adm
/support
/_wizdel.p
*/
259 /* SmartBrowser Wizard
260 Destroy on next read
*/
261 /* _UIB-CODE-BLOCK-END
*/
265 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
266 /* ************************* Included-Libraries
*********************** */
268 {src
/adm
/method
/browser.i
}
269 {inc
/method
/m-selvwr.i
}
271 /* _UIB-CODE-BLOCK-END
*/
277 /* ************************ Control Triggers
************************ */
279 &Scoped-define BROWSE-NAME br_table
280 &Scoped-define SELF-NAME br_table
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
282 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
284 /* This code displays initial values for newly added or copied rows.
*/
285 {src
/adm
/template
/brsentry.i
}
288 /* _UIB-CODE-BLOCK-END
*/
292 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
293 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
295 /* Do not disable this code or no updates will take place except
296 by pressing the Save button on an Update SmartPanel.
*/
297 {src
/adm
/template
/brsleave.i
}
300 /* _UIB-CODE-BLOCK-END
*/
304 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
305 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
307 /* This ADM trigger code must be preserved in order to notify other
308 objects when the browser's current row changes.
*/
309 {src
/adm
/template
/brschnge.i
}
313 /* _UIB-CODE-BLOCK-END
*/
319 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
322 /* *************************** Main Block
*************************** */
324 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
325 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
328 /* _UIB-CODE-BLOCK-END
*/
332 /* ********************** Internal Procedures
*********************** */
334 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
335 PROCEDURE adm-open-query-cases
:
336 /*------------------------------------------------------------------------------
337 Purpose
: Opens different cases of the query based on attributes
338 such as the 'Key-Name'
, or 'SortBy-Case'
340 ------------------------------------------------------------------------------*/
341 DEF VAR key-value
AS CHAR NO-UNDO.
343 /* Look up the current key-value.
*/
344 RUN get-attribute
('Key-Value'
:U
).
345 key-value
= RETURN-VALUE.
347 /* Find the current record using the current Key-Name.
*/
348 RUN get-attribute
('Key-Name'
:U
).
350 WHEN 'BatchType'
:U
THEN DO:
351 &Scope KEY-PHRASE NewBatch.BatchType eq key-value
352 {&OPEN-QUERY-{&BROWSE-NAME}}
355 &Scope KEY-PHRASE TRUE
356 {&OPEN-QUERY-{&BROWSE-NAME}}
357 END.
/* OTHERWISE...
*/
362 /* _UIB-CODE-BLOCK-END
*/
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
367 PROCEDURE adm-row-available
:
368 /*------------------------------------------------------------------------------
369 Purpose
: Dispatched to this procedure when the Record-
370 Source has a new row available. This procedure
371 tries to get the new row
(or foriegn keys
) from
372 the Record-Source and process it.
374 ------------------------------------------------------------------------------*/
376 /* Define variables needed by this internal procedure.
*/
377 {src
/adm
/template
/row-head.i
}
379 /* Process the newly available records
(i.e. display fields
,
380 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
381 {src
/adm
/template
/row-end.i
}
385 /* _UIB-CODE-BLOCK-END
*/
389 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
390 PROCEDURE disable_UI
:
391 /*------------------------------------------------------------------------------
392 Purpose
: DISABLE the User Interface
394 Notes
: Here we clean-up the user-interface by deleting
395 dynamic widgets we have created and
/or hide
396 frames. This procedure is usually called when
397 we are ready to
"clean-up" after running.
398 ------------------------------------------------------------------------------*/
399 /* Hide all frames.
*/
401 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
404 /* _UIB-CODE-BLOCK-END
*/
408 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
410 /*------------------------------------------------------------------------------
411 Purpose
: Sends a requested
KEY value back to the calling
413 Parameters
: <see adm
/template
/sndkytop.i
>
414 ------------------------------------------------------------------------------*/
416 /* Define variables needed by this internal procedure.
*/
417 {src
/adm
/template
/sndkytop.i
}
419 /* Return the key value associated with each key case.
*/
420 {src
/adm
/template
/sndkycas.i
"BatchType" "NewBatch" "BatchType"}
421 {src
/adm
/template
/sndkycas.i
"BatchCode" "NewBatch" "BatchCode"}
422 {src
/adm
/template
/sndkycas.i
"PersonCode" "NewBatch" "PersonCode"}
424 /* Close the
CASE statement and end the procedure.
*/
425 {src
/adm
/template
/sndkyend.i
}
429 /* _UIB-CODE-BLOCK-END
*/
433 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
434 PROCEDURE send-records
:
435 /*------------------------------------------------------------------------------
436 Purpose
: Send record
ROWID's for all tables used by
438 Parameters
: see template
/snd-head.i
439 ------------------------------------------------------------------------------*/
441 /* Define variables needed by this internal procedure.
*/
442 {src
/adm
/template
/snd-head.i
}
444 /* For each requested table
, put it's
ROWID in the output list.
*/
445 {src
/adm
/template
/snd-list.i
"NewBatch"}
446 {src
/adm
/template
/snd-list.i
"Person"}
448 /* Deal with any unexpected table requests before closing.
*/
449 {src
/adm
/template
/snd-end.i
}
453 /* _UIB-CODE-BLOCK-END
*/
457 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
458 PROCEDURE state-changed
:
459 /* -----------------------------------------------------------
463 -------------------------------------------------------------*/
464 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
465 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
468 /* Object instance CASEs can go here to replace standard behavior
470 {src
/adm
/template
/bstates.i
}
474 /* _UIB-CODE-BLOCK-END
*/