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 ------------------------------------------------------------------------*/
16 /* *************************** Definitions
************************** */
18 /* _UIB-CODE-BLOCK-END
*/
22 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
24 /* ******************** Preprocessor Definitions
******************** */
26 &Scoped-define PROCEDURE-TYPE SmartBrowser
28 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
30 /* Name of first Frame and
/or Browse and
/or first Query
*/
31 &Scoped-define FRAME-NAME F-Main
32 &Scoped-define BROWSE-NAME br_table
34 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
35 &Scoped-define INTERNAL-TABLES Inspector Person
37 /* Define KEY-PHRASE in case it is used by any query.
*/
38 &Scoped-define KEY-PHRASE TRUE
40 /* Definitions for
BROWSE br_table
*/
41 &Scoped-define FIELDS-IN-QUERY-br_table Inspector.InspectorCode ~
42 Inspector.CreditorCode Person.FirstName Person.LastName Person.Company
43 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
44 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
45 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH Inspector WHERE ~{&KEY-PHRASE} NO-LOCK, ~
46 EACH Person
OF Inspector
NO-LOCK ~
48 &Scoped-define TABLES-IN-QUERY-br_table Inspector Person
49 &Scoped-define FIRST-TABLE-IN-QUERY-br_table Inspector
52 /* Definitions for
FRAME F-Main
*/
54 /* Standard List Definitions
*/
55 &Scoped-Define ENABLED-OBJECTS br_table
57 /* Custom List Definitions
*/
58 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
60 /* _UIB-PREPROCESSOR-BLOCK-END
*/
64 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
65 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
71 PersonCode||y|TTPL.Inspector.PersonCode
72 CreditorCode||y|TTPL.Inspector.CreditorCode
73 InspectorCode||y|TTPL.Inspector.InspectorCode
74 InspectorIQP||y|TTPL.Inspector.InspectorCode
75 InspectorOwner||y|TTPL.Inspector.InspectorCode
76 EntityCode||y|TTPL.Inspector.CreditorCode
79 **************************
80 * Set attributes related to FOREIGN
KEYS
82 RUN set-attribute-list
(
84 Keys-Supplied
= "PersonCode,CreditorCode,InspectorCode,InspectorIQP,InspectorOwner,EntityCode"'
:U
).
86 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
87 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
88 /**************************
90 /* _UIB-CODE-BLOCK-END
*/
93 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
94 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
102 ************************
103 * Set attributes related to SORTBY-OPTIONS
*/
104 RUN set-attribute-list
(
105 'SortBy-Options
= ""'
:U
).
106 /************************
109 </FILTER-ATTRIBUTES
> */
111 /* _UIB-CODE-BLOCK-END
*/
115 /* *********************** Control Definitions
********************** */
118 /* Definitions of the field level widgets
*/
119 /* Query definitions
*/
121 DEFINE QUERY br_table
FOR
126 /* Browse definitions
*/
127 DEFINE BROWSE br_table
128 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
129 QUERY br_table
NO-LOCK DISPLAY
130 Inspector.InspectorCode
COLUMN-LABEL "Code" FORMAT ">>>9"
131 Inspector.CreditorCode
132 Person.FirstName
FORMAT "X(12)"
133 Person.LastName
FORMAT "X(12)"
135 /* _UIB-CODE-BLOCK-END
*/
137 WITH NO-ASSIGN SEPARATORS SIZE 83.43 BY 13.8
141 /* ************************ Frame Definitions
*********************** */
144 br_table
AT ROW 1 COL 1
145 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
146 SIDE-LABELS NO-UNDERLINE THREE-D
147 AT COL 1 ROW 1 SCROLLABLE
148 BGCOLOR 16 FGCOLOR 0 FONT 10.
151 /* *********************** Procedure Settings
************************ */
153 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
154 /* Settings for
THIS-PROCEDURE
158 Add Fields to
: EXTERNAL-TABLES
159 Other Settings
: PERSISTENT-ONLY
COMPILE
162 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
163 /* then cleanup and return.
*/
164 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
165 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
166 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
170 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
172 /* ************************* Create Window
************************** */
174 &ANALYZE-SUSPEND _CREATE-WINDOW
175 /* DESIGN Window definition
(used by the UIB
)
176 CREATE WINDOW B-table-Win
ASSIGN
179 /* END WINDOW DEFINITION
*/
184 /* *************** Runtime Attributes and UIB Settings
************** */
186 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
187 /* SETTINGS
FOR WINDOW B-table-Win
188 NOT-VISIBLE
,,RUN-PERSISTENT
*/
189 /* SETTINGS
FOR FRAME F-Main
190 NOT-VISIBLE Size-to-Fit
*/
191 /* BROWSE-TAB br_table
1 F-Main
*/
193 FRAME F-Main
:SCROLLABLE = FALSE
194 FRAME F-Main
:HIDDEN = TRUE.
196 /* _RUN-TIME-ATTRIBUTES-END
*/
200 /* Setting information for Queries and Browse Widgets fields
*/
202 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
203 /* Query rebuild information for
BROWSE br_table
204 _TblList
= "TTPL.Inspector,TTPL.Person OF TTPL.Inspector"
205 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
206 _FldNameList
[1] > TTPL.Inspector.InspectorCode
207 "Inspector.InspectorCode" "Code" ">>>9" "integer" ? ? ? ? ? ? no ?
208 _FldNameList
[2] = TTPL.Inspector.CreditorCode
209 _FldNameList
[3] > TTPL.Person.FirstName
210 "Person.FirstName" ?
"X(12)" "character" ? ? ? ? ? ? no ?
211 _FldNameList
[4] > TTPL.Person.LastName
212 "Person.LastName" ?
"X(12)" "character" ? ? ? ? ? ? no ?
213 _FldNameList
[5] = TTPL.Person.Company
215 */ /* BROWSE br_table
*/
218 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
219 /* Query rebuild information for
FRAME F-Main
222 */ /* FRAME F-Main
*/
228 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
229 /* ************************* Included-Libraries
*********************** */
231 {src
/adm
/method
/browser.i
}
232 {inc
/method
/m-drlvwr.i
}
234 /* _UIB-CODE-BLOCK-END
*/
240 /* ************************ Control Triggers
************************ */
242 &Scoped-define BROWSE-NAME br_table
243 &Scoped-define SELF-NAME br_table
244 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
245 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
247 /* This code displays initial values for newly added or copied rows.
*/
248 {src
/adm
/template
/brsentry.i
}
251 /* _UIB-CODE-BLOCK-END
*/
255 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
256 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
258 /* Do not disable this code or no updates will take place except
259 by pressing the Save button on an Update SmartPanel.
*/
260 {src
/adm
/template
/brsleave.i
}
263 /* _UIB-CODE-BLOCK-END
*/
267 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
268 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
270 /* This ADM trigger code must be preserved in order to notify other
271 objects when the browser's current row changes.
*/
272 {src
/adm
/template
/brschnge.i
}
275 /* _UIB-CODE-BLOCK-END
*/
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
284 /* *************************** Main Block
*************************** */
286 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
287 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
290 /* _UIB-CODE-BLOCK-END
*/
294 /* ********************** Internal Procedures
*********************** */
296 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
297 PROCEDURE adm-open-query-cases
:
298 /*------------------------------------------------------------------------------
299 Purpose
: Opens different cases of the query based on attributes
300 such as the 'Key-Name'
, or 'SortBy-Case'
302 ------------------------------------------------------------------------------*/
304 /* No Foreign keys are accepted by this SmartObject.
*/
306 {&OPEN-QUERY-{&BROWSE-NAME}}
310 /* _UIB-CODE-BLOCK-END
*/
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
315 PROCEDURE adm-row-available
:
316 /*------------------------------------------------------------------------------
317 Purpose
: Dispatched to this procedure when the Record-
318 Source has a new row available. This procedure
319 tries to get the new row
(or foriegn keys
) from
320 the Record-Source and process it.
322 ------------------------------------------------------------------------------*/
324 /* Define variables needed by this internal procedure.
*/
325 {src
/adm
/template
/row-head.i
}
327 /* Process the newly available records
(i.e. display fields
,
328 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
329 {src
/adm
/template
/row-end.i
}
333 /* _UIB-CODE-BLOCK-END
*/
337 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-inspector B-table-Win
338 PROCEDURE delete-inspector
:
339 /*------------------------------------------------------------------------------
341 ------------------------------------------------------------------------------*/
342 IF NOT AVAILABLE(Inspector
) THEN RETURN.
344 DEF VAR do-it
AS LOGI
NO-UNDO INITIAL No.
346 MESSAGE "Really? Delete this inspector?" VIEW-AS ALERT-BOX QUESTION
348 TITLE "Confirm Deletion"
351 FIND CURRENT Inspector
EXCLUSIVE-LOCK.
354 RUN dispatch
( 'open-query'
:U
).
358 /* _UIB-CODE-BLOCK-END
*/
362 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
363 PROCEDURE disable_UI
:
364 /*------------------------------------------------------------------------------
365 Purpose
: DISABLE the User Interface
367 Notes
: Here we clean-up the user-interface by deleting
368 dynamic widgets we have created and
/or hide
369 frames. This procedure is usually called when
370 we are ready to
"clean-up" after running.
371 ------------------------------------------------------------------------------*/
372 /* Hide all frames.
*/
374 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
377 /* _UIB-CODE-BLOCK-END
*/
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
383 /*------------------------------------------------------------------------------
384 Purpose
: Sends a requested
KEY value back to the calling
386 Parameters
: <see adm
/template
/sndkytop.i
>
387 ------------------------------------------------------------------------------*/
389 /* Define variables needed by this internal procedure.
*/
390 {src
/adm
/template
/sndkytop.i
}
392 /* Return the key value associated with each key case.
*/
393 {src
/adm
/template
/sndkycas.i
"PersonCode" "Inspector" "PersonCode"}
394 {src
/adm
/template
/sndkycas.i
"CreditorCode" "Inspector" "CreditorCode"}
395 {src
/adm
/template
/sndkycas.i
"InspectorCode" "Inspector" "InspectorCode"}
396 {src
/adm
/template
/sndkycas.i
"InspectorIQP" "Inspector" "InspectorCode"}
397 {src
/adm
/template
/sndkycas.i
"InspectorOwner" "Inspector" "InspectorCode"}
398 {src
/adm
/template
/sndkycas.i
"EntityCode" "Inspector" "CreditorCode"}
400 /* Close the
CASE statement and end the procedure.
*/
401 {src
/adm
/template
/sndkyend.i
}
405 /* _UIB-CODE-BLOCK-END
*/
409 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
410 PROCEDURE send-records
:
411 /*------------------------------------------------------------------------------
412 Purpose
: Send record
ROWID's for all tables used by
414 Parameters
: see template
/snd-head.i
415 ------------------------------------------------------------------------------*/
417 /* Define variables needed by this internal procedure.
*/
418 {src
/adm
/template
/snd-head.i
}
420 /* For each requested table
, put it's
ROWID in the output list.
*/
421 {src
/adm
/template
/snd-list.i
"Inspector"}
422 {src
/adm
/template
/snd-list.i
"Person"}
424 /* Deal with any unexpected table requests before closing.
*/
425 {src
/adm
/template
/snd-end.i
}
429 /* _UIB-CODE-BLOCK-END
*/
433 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
434 PROCEDURE state-changed
:
435 /* -----------------------------------------------------------
439 -------------------------------------------------------------*/
440 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
441 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
444 /* Object instance CASEs can go here to replace standard behavior
446 {src
/adm
/template
/bstates.i
}
450 /* _UIB-CODE-BLOCK-END
*/