1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11 GUI ADM1
3 &Scoped-define WINDOW-NAME CURRENT-WINDOW
4 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS s-object
5 /*------------------------------------------------------------------------
10 A Filter-Source that has a button for every letter of the
11 alphabet
, and which sends requests to
:
12 RUN set-attribute-list
IN <Filter-Target
> ('FILTER-VALUE
= <letter
>'
:U
)
13 The Filter-Source will also automatically dispatch 'open-query'
14 to the Filter-Target if the attribute
"dispatch-open-query" is
23 Authors
: Rick Kuzyk and Wm.T.Wood
24 Created
: November
1995
25 ------------------------------------------------------------------------*/
26 /* This .W file was created with the Progress UIB.
*/
27 /*----------------------------------------------------------------------*/
29 /* Create an unnamed pool to store all the widgets created
30 by this procedure. This is a good default which assures
31 that this procedure's triggers and internal procedures
32 will execute in this procedure's storage
, and that proper
33 cleanup will occur on deletion of the procedure.
*/
37 /* *************************** Definitions
************************** */
39 /* Parameters Definitions
--- */
41 /* Local Variable Definitions
--- */
43 /* ADM Preprocessor Defintions
--- */
44 &Scoped-define adm-attribute-dlg adm/support/abcd.w
46 /* _UIB-CODE-BLOCK-END
*/
50 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
52 /* ******************** Preprocessor Definitions
******************** */
54 &Scoped-define PROCEDURE-TYPE SmartPanel
55 &Scoped-define DB-AWARE no
57 &Scoped-define ADM-SUPPORTED-LINKS Filter-Source
59 /* Name of first Frame and
/or Browse and
/or first Query
*/
60 &Scoped-define FRAME-NAME F-Main
62 /* Standard List Definitions
*/
63 &Scoped-Define ENABLED-OBJECTS b-a b-b b-c b-d b-e b-f b-g b-h b-i b-j b-k ~
64 b-l b-m b-n b-o b-p b-q b-r b-s b-t b-u b-v b-w b-x b-y b-z b-all RECT-1
66 /* Custom List Definitions
*/
67 /* Box-Rectangle
,List-2
,List-3
,List-4
,List-5
,List-6
*/
68 &Scoped-define Box-Rectangle RECT-1
70 /* _UIB-PREPROCESSOR-BLOCK-END
*/
75 /* *********************** Control Definitions
********************** */
78 /* Definitions of the field level widgets
*/
214 DEFINE RECTANGLE RECT-1
215 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
219 /* ************************ Frame Definitions
*********************** */
222 b-a
AT ROW 1.1 COL 1.43
223 b-b
AT ROW 1.1 COL 2.86
224 b-c
AT ROW 1.1 COL 4.29
225 b-d
AT ROW 1.1 COL 5.72
226 b-e
AT ROW 1.1 COL 7.14
227 b-f
AT ROW 1.1 COL 8.57
228 b-g
AT ROW 1.1 COL 10
229 b-h
AT ROW 1.1 COL 11.43
230 b-i
AT ROW 1.1 COL 12.86
231 b-j
AT ROW 1.1 COL 14.29
232 b-k
AT ROW 1.1 COL 15.72
233 b-l
AT ROW 1.1 COL 17.14
234 b-m
AT ROW 1.1 COL 18.57
235 b-n
AT ROW 1.1 COL 20
236 b-o
AT ROW 1.1 COL 21.43
237 b-p
AT ROW 1.1 COL 22.86
238 b-q
AT ROW 1.1 COL 24.29
239 b-r
AT ROW 1.1 COL 25.72
240 b-s
AT ROW 1.1 COL 27.14
241 b-t
AT ROW 1.1 COL 28.57
242 b-u
AT ROW 1.1 COL 30
243 b-v
AT ROW 1.1 COL 31.43
244 b-w
AT ROW 1.1 COL 32.86
245 b-x
AT ROW 1.1 COL 34.29
246 b-y
AT ROW 1.1 COL 35.72
247 b-z
AT ROW 1.1 COL 37.14
248 b-all
AT ROW 1.1 COL 38.57
249 RECT-1
AT ROW 1 COL 1
250 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
251 SIDE-LABELS NO-UNDERLINE THREE-D
252 AT COL 1 ROW 1 SCROLLABLE
256 /* *********************** Procedure Settings
************************ */
258 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
259 /* Settings for
THIS-PROCEDURE
263 Add Fields to
: NEITHER
264 Other Settings
: PERSISTENT-ONLY
COMPILE
267 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
268 /* then cleanup and return.
*/
269 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
270 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
271 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
275 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
277 /* ************************* Create Window
************************** */
279 &ANALYZE-SUSPEND _CREATE-WINDOW
280 /* DESIGN Window definition
(used by the UIB
)
281 CREATE WINDOW s-object
ASSIGN
284 /* END WINDOW DEFINITION
*/
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB s-object
289 /* ************************* Included-Libraries
*********************** */
291 {src
/adm
/method
/smart.i
}
292 {src
/adm
/method
/panelsiz.i
}
294 /* _UIB-CODE-BLOCK-END
*/
300 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
302 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
303 /* SETTINGS
FOR WINDOW s-object
304 VISIBLE,,RUN-PERSISTENT
*/
305 /* SETTINGS
FOR FRAME F-Main
306 NOT-VISIBLE Size-to-Fit
*/
308 FRAME F-Main
:SCROLLABLE = FALSE
309 FRAME F-Main
:HIDDEN = TRUE.
311 /* SETTINGS
FOR RECTANGLE RECT-1
IN FRAME F-Main
313 /* _RUN-TIME-ATTRIBUTES-END
*/
317 /* Setting information for Queries and Browse Widgets fields
*/
319 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
320 /* Query rebuild information for
FRAME F-Main
323 */ /* FRAME F-Main
*/
330 /* ************************ Control Triggers
************************ */
332 &Scoped-define SELF-NAME b-a
333 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL b-a s-object
334 ON CHOOSE OF b-a
IN FRAME F-Main
/* A
*/
335 OR CHOOSE OF b-all
, b-b
, b-c
, b-d
, b-e
, b-f
, b-g
, b-h
, b-i
, b-j
, b-k
, b-l
, b-m
,
336 b-n
, b-o
, b-p
, b-q
, b-r
, b-s
, b-t
, b-u
, b-v
, b-w
, b-x
, b-y
, b-z
338 DEF VAR c-list
AS CHAR NO-UNDO.
339 DEF VAR h_target
AS HANDLE NO-UNDO.
340 DEF VAR i
AS INTEGER NO-UNDO.
341 DEF VAR iCnt
AS INTEGER NO-UNDO.
344 * Get all the FILTER-TARGETS
- Tell them to set their filter value.
346 RUN get-link-handle
IN adm-broker-hdl
347 (THIS-PROCEDURE, 'Filter-Target'
:U
, OUTPUT c-list
).
348 iCnt
= NUM-ENTRIES (c-list
).
350 THEN MESSAGE "No Filter-Target exists for this object." VIEW-AS ALERT-BOX WARNING.
353 h_target
= WIDGET-HANDLE (ENTRY(i
,c-list
)).
354 IF VALID-HANDLE (h_target
) THEN DO:
355 RUN set-attribute-list
IN h_target
356 ('Filter-Value
='
:U
+ (IF SELF:LABEL eq '
*'
:U
THEN ''
:U
ELSE SELF:LABEL)).
358 * Only open the query in the Filter-Target if necessary.
360 RUN get-attribute
IN THIS-PROCEDURE ('Dispatch-Open-Query'
:U
).
361 IF RETURN-VALUE eq 'yes'
:U
THEN DO:
362 RUN dispatch
IN h_target
('open-query'
:U
).
363 RUN dispatch
IN h_target
('apply-entry'
:U
).
370 /* _UIB-CODE-BLOCK-END
*/
376 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK s-object
379 /* *************************** Main Block
*************************** */
381 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
382 /* Code needed to test this object
(when run directly from the UIB
) */
383 RUN dispatch
IN THIS-PROCEDURE ('initialize'
).
386 /* _UIB-CODE-BLOCK-END
*/
390 /* ********************** Internal Procedures
*********************** */
392 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI s-object _DEFAULT-DISABLE
393 PROCEDURE disable_UI
:
394 /*------------------------------------------------------------------------------
395 Purpose
: DISABLE the User Interface
397 Notes
: Here we clean-up the user-interface by deleting
398 dynamic widgets we have created and
/or hide
399 frames. This procedure is usually called when
400 we are ready to
"clean-up" after running.
401 ------------------------------------------------------------------------------*/
402 /* Hide all frames.
*/
404 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
407 /* _UIB-CODE-BLOCK-END
*/
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-initialize s-object
411 PROCEDURE local-initialize
:
412 /*------------------------------------------------------------------------------
413 Purpose
: Override standard ADM method
415 ------------------------------------------------------------------------------*/
417 /* Code placed here will execute PRIOR to standard behavior.
*/
418 RUN use-button-font
(?
).
420 /* Dispatch standard ADM method.
*/
421 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'initialize'
:U
) .
423 /* Code placed here will execute AFTER standard behavior.
*/
427 /* _UIB-CODE-BLOCK-END
*/
430 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-UIB-mode s-object
431 PROCEDURE local-UIB-mode
:
432 /*------------------------------------------------------------------------------
433 Purpose
: Override standard ADM method. If the object has just been drawn
434 in the UIB
, then make sure it is sized correctly.
437 ------------------------------------------------------------------------------*/
439 /* Code placed here will execute PRIOR to standard behavior.
*/
441 /* Dispatch standard ADM method.
*/
442 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'UIB-mode'
:U
) .
444 /* Code placed here will execute AFTER standard behavior.
*/
445 RUN get-attribute
('Drawn-in-UIB'
:U
).
446 IF RETURN-VALUE eq ?
THEN DO:
447 /* Set default values for Parameters
*/
448 RUN get-attribute
('Button-Font'
:U
).
449 IF RETURN-VALUE eq ?
THEN RUN set-attribute-list
('Button-Font
= 4'
:U
).
450 RUN get-attribute
('Dispatch-Open-Query'
:U
).
451 IF RETURN-VALUE eq ?
THEN RUN set-attribute-list
('Dispatch-Open-Query
= yes'
:U
).
452 RUN get-attribute
('Edge-Pixels'
:U
).
453 IF RETURN-VALUE eq ?
THEN RUN set-attribute-list
('Edge-Pixels
= 2'
:U
).
454 RUN get-attribute
('Margin-Pixels'
:U
).
455 IF RETURN-VALUE eq ?
THEN RUN set-attribute-list
('Margin-Pixels
= 5'
:U
).
457 /* Set the
FONT and
SIZE.
*/
458 RUN use-button-font
(?
).
460 /* Make sure the object has been sized correctly.
(This will process
461 edge-pixels and margin-pixels.
*/
462 RUN set-size
IN THIS-PROCEDURE
463 (FRAME {&FRAME-NAME}:HEIGHT, FRAME {&FRAME-NAME}:WIDTH).
465 /* Mark this as having been drawn.
*/
466 RUN set-attribute-list
('Drawn-in-UIB
=yes'
:U
).
471 /* _UIB-CODE-BLOCK-END
*/
474 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed s-object
475 PROCEDURE state-changed
:
476 /* -----------------------------------------------------------
480 -------------------------------------------------------------*/
481 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
482 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
485 /* Object instance CASEs can go here to replace standard behavior
490 /* _UIB-CODE-BLOCK-END
*/
493 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-button-font s-object
494 PROCEDURE use-button-font
:
495 /*------------------------------------------------------------------------------
496 Purpose
: Get the current value of 'button-font' and set the font of all
497 buttons to this value.
498 Parameters
: p_attr-value
-- the new Button Font
499 Notes
: The desired font is checked against Button b-a. If b-a has the desired
500 font then no change is made.
501 ------------------------------------------------------------------------------*/
502 DEFINE INPUT PARAMETER p_attr-value
AS CHAR NO-UNDO.
504 DEFINE VAR iFont
AS INTEGER INITIAL ?
NO-UNDO.
505 DEFINE VAR h
AS WIDGET NO-UNDO.
507 /* Convert attribute string to an
INTEGER font value.
*/
508 iFont
= IF p_attr-value eq
"?" THEN ?
ELSE INTEGER(p_attr-value
) NO-ERROR.
509 IF ERROR-STATUS:ERROR THEN DO:
511 RUN get-attribute
IN THIS-PROCEDURE ('button-font'
:U
).
512 iFont
= IF RETURN-VALUE eq
"?":U
THEN ?
ELSE INTEGER(RETURN-VALUE) NO-ERROR.
516 DO WITH FRAME {&FRAME-NAME}:
517 /* Is the correct font set already?
*/
518 IF iFont ne b-a
:FONT THEN DO:
519 /* Walk the widget tree and set the font of all buttons in this frame .
*/
520 ASSIGN h
= FRAME {&FRAME-NAME}:CURRENT-ITERATION
522 DO WHILE VALID-HANDLE (h
):
523 IF h
:TYPE eq '
BUTTON'
:U
THEN h
:FONT = iFont.
525 END.
/* DO WHILE...h...
*/
526 END.
/* IF iFont ne b-a
:FONT...
*/
527 END.
/* DO WITH FRAME...
*/
530 /* _UIB-CODE-BLOCK-END
*/
533 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-edge-pixels s-object
534 PROCEDURE use-edge-pixels
:
535 /*------------------------------------------------------------------------------
536 Purpose
: Use the current value of 'Edge-Pixels' in the
{&Box-Rectangle}.
537 Parameters
: p_attr-value
- (CHAR) the new value of the 'Font' Attribute
538 Notes
: Default to
2 if unknown.
)
539 ------------------------------------------------------------------------------*/
540 DEFINE INPUT PARAMETER p_attr-value
AS CHAR NO-UNDO.
542 /* We need do nothing is there is no box rectangle.
*/
543 &IF NUM-ENTRIES("{&Box-Rectangle}") eq 1 &THEN
544 DEFINE VAR iEdge
AS INTEGER NO-UNDO.
546 /* Get the desired Edge-Pixels.
*/
547 iEdge
= INTEGER(p_attr-value
) NO-ERROR.
548 /* Is the correct font set already?
*/
549 DO WITH FRAME {&FRAME-NAME}:
550 IF iEdge ne
{&Box-Rectangle}:EDGE-PIXELS
551 THEN {&Box-Rectangle}:EDGE-PIXELS = iEdge.
557 /* _UIB-CODE-BLOCK-END
*/