1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
3 &Scoped-define WINDOW-NAME CURRENT-WINDOW
4 &Scoped-define FRAME-NAME Dialog-Frame
5 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame
6 /*------------------------------------------------------------------------
8 Description
: Select the database to use
9 Input Parameters
: CHAR select-from
10 Output Parameters
: CHAR chosen
11 Author
: Andrew McMillan
13 ------------------------------------------------------------------------*/
15 DEF INPUT PARAMETER select-from
AS CHAR NO-UNDO.
16 DEF INPUT-OUTPUT PARAMETER chosen
AS CHAR NO-UNDO.
18 /* _UIB-CODE-BLOCK-END
*/
22 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
24 /* ******************** Preprocessor Definitions
******************** */
26 &Scoped-define PROCEDURE-TYPE DIALOG-BOX
28 /* Name of first Frame and
/or Browse and
/or first Query
*/
29 &Scoped-define FRAME-NAME Dialog-Frame
31 /* Standard List Definitions
*/
32 &Scoped-Define ENABLED-OBJECTS cmb_Database Btn_OK Btn_Cancel Btn_Help
33 &Scoped-Define DISPLAYED-OBJECTS cmb_Database
35 /* Custom List Definitions
*/
36 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
38 /* _UIB-PREPROCESSOR-BLOCK-END
*/
43 /* *********************** Control Definitions
********************** */
45 /* Define a dialog box
*/
47 /* Definitions of the field level widgets
*/
48 DEFINE BUTTON Btn_Cancel
AUTO-END-KEY
53 DEFINE BUTTON Btn_Help
58 DEFINE BUTTON Btn_OK
AUTO-GO
63 DEFINE VARIABLE cmb_Database
AS CHARACTER FORMAT "X(256)":U
65 VIEW-AS COMBO-BOX INNER-LINES 10
67 SIZE 54.29 BY 1.05 NO-UNDO.
70 /* ************************ Frame Definitions
*********************** */
72 DEFINE FRAME Dialog-Frame
73 cmb_Database
AT ROW 1.6 COL 1.57
74 Btn_OK
AT ROW 5 COL 1.57
75 Btn_Cancel
AT ROW 5 COL 17.57
76 Btn_Help
AT ROW 5 COL 48.43
77 SPACE(1.70) SKIP(1.99)
78 WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
79 SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
81 TITLE "Select Database"
82 DEFAULT-BUTTON Btn_OK
CANCEL-BUTTON Btn_Cancel.
85 /* *********************** Procedure Settings
************************ */
87 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
88 /* Settings for
THIS-PROCEDURE
90 Allow
: Basic
,Browse
,DB-Fields
,Query
91 Other Settings
: COMPILE
93 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
96 /* *************** Runtime Attributes and UIB Settings
************** */
98 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
99 /* SETTINGS
FOR DIALOG-BOX Dialog-Frame
102 FRAME Dialog-Frame
:SCROLLABLE = FALSE
103 FRAME Dialog-Frame
:HIDDEN = TRUE.
105 /* SETTINGS
FOR COMBO-BOX cmb_Database
IN FRAME Dialog-Frame
107 /* _RUN-TIME-ATTRIBUTES-END
*/
115 /* ************************ Control Triggers
************************ */
117 &Scoped-define SELF-NAME Dialog-Frame
118 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
119 ON WINDOW-CLOSE
OF FRAME Dialog-Frame
/* Select Database
*/
121 APPLY "END-ERROR":U
TO SELF.
124 /* _UIB-CODE-BLOCK-END
*/
128 &Scoped-define SELF-NAME Btn_Cancel
129 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Cancel Dialog-Frame
130 ON CHOOSE OF Btn_Cancel
IN FRAME Dialog-Frame
/* Cancel
*/
135 /* _UIB-CODE-BLOCK-END
*/
139 &Scoped-define SELF-NAME Btn_Help
140 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_Help Dialog-Frame
141 ON CHOOSE OF Btn_Help
IN FRAME Dialog-Frame
/* Help
*/
142 OR HELP OF FRAME {&FRAME-NAME}
143 DO: /* Call Help Function
(or a simple message
).
*/
144 MESSAGE "Select the database you wish to access" SKIP
145 "and click on the OK button."
146 VIEW-AS ALERT-BOX INFORMATION.
149 /* _UIB-CODE-BLOCK-END
*/
153 &Scoped-define SELF-NAME Btn_OK
154 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK Dialog-Frame
155 ON CHOOSE OF Btn_OK
IN FRAME Dialog-Frame
/* OK */
157 DO WITH FRAME {&FRAME-NAME}:
158 chosen
= cmb_Database
:SCREEN-VALUE.
162 /* _UIB-CODE-BLOCK-END
*/
168 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Dialog-Frame
171 /* *************************** Main Block
*************************** */
173 /* Parent the dialog-box to the
ACTIVE-WINDOW, if there is no parent.
*/
174 IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ?
175 THEN FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.
177 DO WITH FRAME {&FRAME-NAME}:
178 cmb_Database
:DELIMITER = "~n".
179 cmb_Database
:LIST-ITEMS = select-from.
180 cmb_Database
:SCREEN-VALUE = chosen.
183 /* Now enable the interface and wait for the exit condition.
*/
184 /* (NOTE
: handle
ERROR and
END-KEY so cleanup code will always fire.
*/
186 DO ON ERROR UNDO MAIN-BLOCK
, LEAVE MAIN-BLOCK
187 ON END-KEY UNDO MAIN-BLOCK
, LEAVE MAIN-BLOCK
:
189 WAIT-FOR GO
OF FRAME {&FRAME-NAME}.
193 /* _UIB-CODE-BLOCK-END
*/
197 /* ********************** Internal Procedures
*********************** */
199 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI Dialog-Frame _DEFAULT-DISABLE
200 PROCEDURE disable_UI
:
201 /*------------------------------------------------------------------------------
202 Purpose
: DISABLE the User Interface
204 Notes
: Here we clean-up the user-interface by deleting
205 dynamic widgets we have created and
/or hide
206 frames. This procedure is usually called when
207 we are ready to
"clean-up" after running.
208 ------------------------------------------------------------------------------*/
209 /* Hide all frames.
*/
210 HIDE FRAME Dialog-Frame.
213 /* _UIB-CODE-BLOCK-END
*/
217 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI Dialog-Frame _DEFAULT-ENABLE
218 PROCEDURE enable_UI
:
219 /*------------------------------------------------------------------------------
220 Purpose
: ENABLE the User Interface
222 Notes
: Here we display
/view
/enable the widgets in the
223 user-interface. In addition
, OPEN all queries
224 associated with each
FRAME and
BROWSE.
225 These statements here are based on the
"Other
226 Settings" section of the widget Property Sheets.
227 ------------------------------------------------------------------------------*/
229 WITH FRAME Dialog-Frame.
230 ENABLE cmb_Database Btn_OK Btn_Cancel Btn_Help
231 WITH FRAME Dialog-Frame.
232 VIEW FRAME Dialog-Frame.
233 {&OPEN-BROWSERS-IN-QUERY-Dialog-Frame}
236 /* _UIB-CODE-BLOCK-END
*/