1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Method-Library
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 /* *************************** Definitions
************************** */
9 DEF VAR have-records
AS LOGI
INIT NO NO-UNDO.
10 DEF VAR this-file
AS CHAR NO-UNDO.
12 /* _UIB-CODE-BLOCK-END
*/
16 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
18 /* ******************** Preprocessor Definitions
******************** */
22 /* _UIB-PREPROCESSOR-BLOCK-END
*/
26 /* ************************ Function Prototypes
********************** */
28 &IF DEFINED(EXCLUDE-find-parent-key) = 0 &THEN
30 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD find-parent-key Method-Library
31 FUNCTION find-parent-key
RETURNS CHARACTER
32 ( INPUT key-name
AS CHAR ) FORWARD.
34 /* _UIB-CODE-BLOCK-END
*/
40 /* *********************** Procedure Settings
************************ */
42 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
43 /* Settings for
THIS-PROCEDURE
47 Add Fields to
: Neither
48 Other Settings
: INCLUDE-ONLY
50 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
52 /* ************************* Create Window
************************** */
54 &ANALYZE-SUSPEND _CREATE-WINDOW
55 /* DESIGN Window definition
(used by the UIB
)
56 CREATE WINDOW Method-Library
ASSIGN
59 /* END WINDOW DEFINITION
*/
65 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Method-Library
66 /* ************************* Included-Libraries
*********************** */
68 {inc
/method
/m-sysmgr.i
}
69 {inc
/method
/m-utils.i
}
71 /* _UIB-CODE-BLOCK-END
*/
76 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Method-Library
79 /* *************************** Main Block
*************************** */
80 this-file
= REPLACE( SEARCH( THIS-PROCEDURE:FILE-NAME ), "\", "/" ).
81 this-file
= REPLACE( this-file
, "./", "" ).
83 RUN set-attribute-list
(
84 "frame-handle = " + STRING( FRAME {&FRAME-NAME}:HANDLE ) + "," +
85 "filename = " + this-file
).
87 /* _UIB-CODE-BLOCK-END
*/
91 /* ********************** Internal Procedures
*********************** */
93 &IF DEFINED(EXCLUDE-get-topic-desc) = 0 &THEN
95 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-topic-desc Method-Library
96 PROCEDURE get-topic-desc
:
97 /*------------------------------------------------------------------------------
98 Purpose
: Get the description of the topic for this
100 ------------------------------------------------------------------------------*/
102 DEF OUTPUT PARAMETER topic-desc
AS CHAR NO-UNDO.
104 &IF DEFINED( TOPIC-TABLE ) NE 0 AND
105 DEFINED( TOPIC-FIELD
) NE 0 &THEN
107 topic-desc
= IF AVAILABLE {&TOPIC-TABLE}
108 THEN {&TOPIC-PREFIX} + " " + STRING({&TOPIC-FIELD})
109 ELSE "{&TOPIC-TABLE}".
110 topic-desc
= TRIM( topic-desc
).
116 /* _UIB-CODE-BLOCK-END
*/
121 &IF DEFINED(EXCLUDE-local-display-fields) = 0 &THEN
123 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-display-fields Method-Library
124 PROCEDURE local-display-fields
:
125 /*------------------------------------------------------------------------------
126 Purpose
: Override standard ADM method
128 ------------------------------------------------------------------------------*/
130 RUN pre-display-fields
IN THIS-PROCEDURE NO-ERROR.
132 /* Dispatch standard ADM method.
*/
133 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'display-fields'
:U
) .
135 /* Code placed here will execute AFTER standard behavior.
*/
136 RUN sub1-display-fields
IN THIS-PROCEDURE NO-ERROR.
137 RUN inst-display-fields
IN THIS-PROCEDURE NO-ERROR.
138 RUN post-display-fields
IN THIS-PROCEDURE NO-ERROR.
142 /* _UIB-CODE-BLOCK-END
*/
147 &IF DEFINED(EXCLUDE-local-enable-fields) = 0 &THEN
149 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-enable-fields Method-Library
150 PROCEDURE local-enable-fields
:
151 /*------------------------------------------------------------------------------
152 Purpose
: Override standard ADM method
154 ------------------------------------------------------------------------------*/
156 /* Code placed here will execute PRIOR to standard behavior.
*/
157 IF INDEX( THIS-PROCEDURE:INTERNAL-ENTRIES, 'override-enable-fields'
) > 0 THEN DO:
158 RUN override-enable-fields
IN THIS-PROCEDURE NO-ERROR.
161 RUN pre-enable-fields
IN THIS-PROCEDURE NO-ERROR.
163 /* Dispatch standard ADM method.
*/
164 IF RETURN-VALUE = "LEAVE" THEN RETURN.
165 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'enable-fields'
:U
) .
166 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, "ALL", "SENSITIVE = Yes" ).
167 RUN inst-enable-fields
IN THIS-PROCEDURE NO-ERROR.
169 /* Code placed here will execute AFTER standard behavior.
*/
173 /* _UIB-CODE-BLOCK-END
*/
178 &IF DEFINED(EXCLUDE-local-initialize) = 0 &THEN
180 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-initialize Method-Library
181 PROCEDURE local-initialize
:
182 /*------------------------------------------------------------------------------
183 Purpose
: Override standard ADM method
185 ------------------------------------------------------------------------------*/
187 /* Code placed here will execute PRIOR to standard behavior.
*/
189 RUN pre-initialize
IN THIS-PROCEDURE NO-ERROR.
190 RUN pre-create-objects
IN THIS-PROCEDURE NO-ERROR.
191 RUN sub1-create-objects
IN THIS-PROCEDURE NO-ERROR.
192 RUN inst-create-objects
IN THIS-PROCEDURE NO-ERROR.
193 RUN post-create-objects
IN THIS-PROCEDURE NO-ERROR.
195 /* Dispatch standard ADM method.
*/
196 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'initialize'
:U
) .
198 /* Code placed here will execute AFTER standard behavior.
*/
200 RUN sub1-initialize
IN THIS-PROCEDURE NO-ERROR.
201 RUN inst-initialize
IN THIS-PROCEDURE NO-ERROR.
202 RUN post-initialize
IN THIS-PROCEDURE NO-ERROR.
206 /* _UIB-CODE-BLOCK-END
*/
211 &IF DEFINED(EXCLUDE-local-row-available) = 0 &THEN
213 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-row-available Method-Library
214 PROCEDURE local-row-available
:
215 /*------------------------------------------------------------------------------
216 Purpose
: Override standard ADM method
218 ------------------------------------------------------------------------------*/
219 IF INDEX( THIS-PROCEDURE:INTERNAL-ENTRIES, 'override-row-available'
) > 0 THEN DO:
220 RUN override-row-available
IN THIS-PROCEDURE NO-ERROR.
223 /* If this viewer has been destroyed or is hidden then just return
*/
225 RUN get-attribute
IN THIS-PROCEDURE( 'adm-object-handle'
:U
).
226 IF NOT VALID-HANDLE( WIDGET-HANDLE( RETURN-VALUE ) ) THEN RETURN.
227 RUN get-attribute
IN THIS-PROCEDURE( 'container-hidden'
).
228 IF RETURN-VALUE = "Yes" THEN RETURN.
230 RUN sub1-pre-row-available
IN THIS-PROCEDURE NO-ERROR.
231 RUN pre-row-available
IN THIS-PROCEDURE NO-ERROR.
233 /* Static link between linked viewers
*/
235 RUN get-attribute
IN THIS-PROCEDURE ( 'Initialized'
:U
).
237 IF RETURN-VALUE = "Yes" AND NOT have-records
THEN
239 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'row-available'
:U
) .
240 RUN inst-row-available
IN THIS-PROCEDURE NO-ERROR.
241 RUN sub1-row-available
IN THIS-PROCEDURE NO-ERROR.
242 RUN post-row-available
IN THIS-PROCEDURE NO-ERROR.
248 /* _UIB-CODE-BLOCK-END
*/
253 &IF DEFINED(EXCLUDE-refresh-topic) = 0 &THEN
255 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE refresh-topic Method-Library
256 PROCEDURE refresh-topic
:
257 /*------------------------------------------------------------------------------
258 Purpose
: Refresh the topic for record-targets
259 ------------------------------------------------------------------------------*/
260 DEF VAR new-topic
AS CHAR NO-UNDO.
262 RUN get-topic-desc
( OUTPUT new-topic
).
267 /* _UIB-CODE-BLOCK-END
*/
272 &IF DEFINED(EXCLUDE-set-busy) = 0 &THEN
274 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-busy Method-Library
276 /*------------------------------------------------------------------------------
280 ------------------------------------------------------------------------------*/
282 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
286 /* _UIB-CODE-BLOCK-END
*/
291 &IF DEFINED(EXCLUDE-set-idle) = 0 &THEN
293 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-idle Method-Library
295 /*------------------------------------------------------------------------------
299 ------------------------------------------------------------------------------*/
301 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
305 /* _UIB-CODE-BLOCK-END
*/
310 &IF DEFINED(EXCLUDE-test-modified) = 0 &THEN
312 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE test-modified Method-Library
313 PROCEDURE test-modified
:
314 /*------------------------------------------------------------------------------
315 Purpose
: Test to see if the current crop of fields is modified
316 ------------------------------------------------------------------------------*/
317 DEF OUTPUT PARAMETER record-changed
AS LOGICAL NO-UNDO INITIAL No.
319 /* This block of code was developed from src
/adm
/method
/tableio.i
- check-modified
*/
320 IF VALID-HANDLE(FRAME {&FRAME-NAME}:HANDLE)
321 &IF DEFINED(adm-first-enabled-table) = 0 &THEN
322 AND AVAILABLE({&adm-first-enabled-table})
325 DEF VAR curr-widget
AS HANDLE NO-UNDO.
327 ASSIGN curr-widget
= FRAME {&FRAME-NAME}:FIRST-CHILD. /* Field group */
328 ASSIGN curr-widget
= curr-widget
:FIRST-CHILD.
/* First field
*/
329 DO WHILE NOT record-changed
AND VALID-HANDLE (curr-widget
):
330 record-changed
= LOOKUP (curr-widget
:TYPE, "FILL-IN,COMBO-BOX,EDITOR,RADIO-SET,SELECTION-LIST,SLIDER,TOGGLE-BOX":U
) NE 0
331 AND curr-widget
:MODIFIED.
332 ASSIGN curr-widget
= curr-widget
:NEXT-SIBLING.
/* next field
*/
338 /* _UIB-CODE-BLOCK-END
*/
343 /* ************************ Function Implementations
***************** */
345 &IF DEFINED(EXCLUDE-find-parent-key) = 0 &THEN
347 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION find-parent-key Method-Library
348 FUNCTION find-parent-key
RETURNS CHARACTER
349 ( INPUT key-name
AS CHAR ) :
350 /*------------------------------------------------------------------------------
353 ------------------------------------------------------------------------------*/
355 DEF VAR key-value
AS CHAR NO-UNDO.
356 DEF VAR curr-hdl
AS HANDLE NO-UNDO.
357 DEF VAR done
AS LOGI
NO-UNDO.
358 DEF VAR c-rec-src
AS CHAR NO-UNDO.
360 curr-hdl
= THIS-PROCEDURE.
364 RUN get-link-handle
IN adm-broker-hdl
( curr-hdl
, 'RECORD-SOURCE'
:U
, OUTPUT c-rec-src
).
366 ASSIGN curr-hdl
= WIDGET-HANDLE( c-rec-src
) NO-ERROR.
368 IF VALID-HANDLE( curr-hdl
) THEN DO:
370 RUN get-attribute
IN curr-hdl
( 'Keys-Supplied'
).
371 IF LOOKUP( key-name
, RETURN-VALUE ) <> 0 THEN DO:
372 RUN send-key
IN curr-hdl
( key-name
, OUTPUT key-value
) NO-ERROR.
373 done
= NOT ERROR-STATUS:ERROR AND key-value
<> ?.
384 /* _UIB-CODE-BLOCK-END
*/