Really, this should be it, for the passing income.
[capital-apms-progress.git] / adecomm / okbar.i
bloba58574deb1dace3113774307760038ed21a11232
1 /*************************************************************/
2 /* Copyright (c) 1984-1996 by Progress Software Corporation */
3 /* */
4 /* All rights reserved. No part of this program or document */
5 /* may be reproduced in any form or by any means without */
6 /* permission in writing from PROGRESS Software Corporation. */
7 /*************************************************************/
9 /* PROGRAM: okbar.i
11 ** This file adds the standard OK/CANCEL/HELP button bar to the bottom of a
12 ** dialog box created in the UIB. This file should be included at the top
13 ** of the Main-Code-Block.
14 ** This file acts as a front end for the trio: adestds.i okform.i okrun.i.
15 ** For more information on this, see the document
16 ** design\ade\misc\sullivan.doc.
18 ** PARAMETERS:
19 ** &BOX widget name of the rectangle to be used for the background box
20 ** (optional)
21 ** &OK widget name of the ok button (optional)
22 ** &CANCEL widget name of the cancel button (optional)
23 ** &OTHER 4GL for any intervening buttons (optional)
24 ** &HELP widget name of the help button (optional)
25 ** &TOOL The name of the tool (eg uib) for use in the
26 ** help trigger
27 ** &CONTEXT Name of the help context string.
28 ** [both &TOOL and &CONTEXT must be available if you
29 ** want a help trigger.]
30 ** If the names are not given explicitly, then default values of
31 ** rect_btn_bar, btn_OK, btn_cancel, and btn_help will be defined.
33 /* ADE standards are required stdui.i for this file */
34 &IF DEFINED(ADESTDSI) = 0 &THEN
35 { adecomm/adestds.i }
36 &ENDIF
38 /* Set defaults for Names */
39 &IF DEFINED(BOX) eq 0 &THEN &SCOPED-DEFINE BOX rect_btn_bar
40 &ENDIF
41 &IF DEFINED(OK) eq 0 &THEN &SCOPED-DEFINE OK btn_OK
42 &ENDIF
43 &IF DEFINED(CANCEL) eq 0 &THEN &SCOPED-DEFINE CANCEL btn_cancel
44 &ENDIF
45 /* NOTE: Help is a keyword so we can't ask for DEFINED(help)*/
46 &IF "{&HELP}" eq "" &THEN &SCOPED-DEFINE HELP btn_help
47 &ENDIF
49 /* standard button rectangle */
50 &IF {&OKBOX} &THEN
51 DEFINE RECTANGLE rect_btn_bar {&STDPH_OKBOX}.
52 &ENDIF
54 /* Buttons for the bottom of the screen */
55 DEFINE BUTTON {&OK} LABEL "OK":C12 {&STDPH_OKBTN} AUTO-GO.
56 DEFINE BUTTON {&CANCEL} LABEL "Cancel":C12 {&STDPH_OKBTN} AUTO-ENDKEY.
57 DEFINE BUTTON {&HELP} LABEL "&Help":C12 {&STDPH_OKBTN}.
58 /* Add these to the frame */
59 DEFINE FRAME {&FRAME-NAME}
60 {adecomm/okform.i}
61 WITH DEFAULT-BUTTON {&OK} CANCEL-BUTTON {&CANCEL} .
63 /* Do run-time layout. ok_run.i lays out width. We need to also do
64 HEIGHT-P. */
65 {adecomm/okrun.i
66 &FRAME = "FRAME {&FRAME-NAME}"
69 /* Adjust the height based on the position of the OK button and the relavent
70 borders (standard borders plus dialog-box border). */
71 ASSIGN FRAME {&FRAME-NAME}:SCROLLABLE = no
72 FRAME {&FRAME-NAME}:HEIGHT = ({&OK}:ROW - 1) + {&OK}:HEIGHT +
73 FRAME {&FRAME-NAME}:BORDER-TOP + FRAME {&FRAME-NAME}:BORDER-BOTTOM +
74 /* if there is an ok box, skip to allow for it below the buttons */
75 &IF {&OKBOX} &THEN {&IVM_OKBOX} + &ENDIF
76 /* skip a margin below the box or the buttons */
77 {&VM_OKBOX}
80 /* Add a standard ADE help trigger */
81 &IF DEFINED(TOOL) ne 0 AND DEFINED(CONTEXT) ne 0 &THEN
82 /* Standard Help Trigger */
83 ON CHOOSE OF {&HELP} OR HELP OF FRAME {&FRAME-NAME} DO:
84 RUN adecomm/_adehelp.p ("{&TOOL}", "CONTEXT", {&CONTEXT}, "").
85 END.
87 &ENDIF
89 /* Enable these new buttons */
90 ENABLE {&OK} {&CANCEL} {&HELP} {&WHEN_HELP} WITH FRAME {&FRAME-NAME}.
92 /* Make sure the OK button is the default button. */
93 ASSIGN FRAME {&FRAME-NAME}:DEFAULT-BUTTON = {&OK}:HANDLE.