1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
3 &Scoped-define WINDOW-NAME W-Win
4 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS W-Win
5 /*------------------------------------------------------------------------
7 Description
: Main Menu process
8 ------------------------------------------------------------------------*/
9 DEF VAR rem-user-name
AS CHAR NO-UNDO.
10 {inc
/username.i
"rem-user-name"}
12 RUN setup-environment.
16 /* *************************** Definitions
************************** */
18 IF SEARCH( "update-in-progress.LCK" ) <> ?
THEN RUN process
/linkimpt.p
( "RESTART" ).
20 DEF VAR img_mainmenu
AS WIDGET-HANDLE NO-UNDO.
22 DEF VAR abbrev
AS CHAR NO-UNDO.
23 DEF VAR org-name
AS CHAR NO-UNDO.
24 DEF VAR icon-file
AS CHAR NO-UNDO.
25 DEF VAR bitmap-file
AS CHAR NO-UNDO.
27 DEF VAR initialized
AS INT NO-UNDO INITIAL 0.
29 DEF VAR remote-user
AS LOGI
NO-UNDO INITIAL No.
31 IF CAN-FIND( UsrGroupMember
WHERE UsrGroupMember.GroupName
= "RemoteUser" AND UsrGroupMember.UserName
= rem-user-name
) THEN
34 /* _UIB-CODE-BLOCK-END
*/
38 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
40 /* ******************** Preprocessor Definitions
******************** */
42 &Scoped-define PROCEDURE-TYPE SmartWindow
43 &Scoped-define DB-AWARE no
45 &Scoped-define ADM-CONTAINER WINDOW
47 /* Name of first Frame and
/or Browse and
/or first Query
*/
48 &Scoped-define FRAME-NAME F-Main
50 /* Standard List Definitions
*/
51 &Scoped-Define ENABLED-OBJECTS RECT-MASTER
52 &Scoped-Define DISPLAYED-OBJECTS fil_CompanyName
54 /* Custom List Definitions
*/
55 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
57 /* _UIB-PREPROCESSOR-BLOCK-END
*/
62 /* *********************** Control Definitions
********************** */
64 /* Define the widget handle for the window
*/
65 DEFINE VAR W-Win
AS WIDGET-HANDLE NO-UNDO.
67 /* Definitions of the field level widgets
*/
68 DEFINE VARIABLE fil_CompanyName
AS CHARACTER FORMAT "X(256)":U
INITIAL "Trans Tasman Properties Limited"
71 FGCOLOR 0 FONT 13 NO-UNDO.
73 DEFINE RECTANGLE RECT-MASTER
78 /* ************************ Frame Definitions
*********************** */
81 fil_CompanyName
AT ROW 1 COL 2.14 NO-LABEL
82 RECT-MASTER
AT ROW 1 COL 1
83 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
84 SIDE-LABELS NO-UNDERLINE THREE-D
90 /* *********************** Procedure Settings
************************ */
92 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
93 /* Settings for
THIS-PROCEDURE
95 Allow
: Basic
,Browse
,DB-Fields
,Query
,Smart
,Window
96 Other Settings
: COMPILE
98 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
100 /* ************************* Create Window
************************** */
102 &ANALYZE-SUSPEND _CREATE-WINDOW
103 IF SESSION:DISPLAY-TYPE = "GUI":U
THEN
104 CREATE WINDOW W-Win
ASSIGN
106 TITLE = "Capital APMS Main Menu"
113 VIRTUAL-HEIGHT = 34.3
114 VIRTUAL-WIDTH = 103.72
120 PRIVATE-DATA = "w-mainmn"
124 ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
126 &IF '{&WINDOW-SYSTEM}' NE 'TTY' &THEN
127 IF NOT W-Win
:LOAD-ICON("BITMAPS\capital":U
) THEN
128 MESSAGE "Unable to load icon: BITMAPS\capital"
129 VIEW-AS ALERT-BOX WARNING BUTTONS OK.
131 /* END WINDOW DEFINITION
*/
134 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB W-Win
135 /* ************************* Included-Libraries
*********************** */
137 {src
/adm
/method
/containr.i
}
138 {inc
/method
/m-mnuwin.i
}
140 /* _UIB-CODE-BLOCK-END
*/
146 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
148 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
149 /* SETTINGS
FOR WINDOW W-Win
150 NOT-VISIBLE
,,RUN-PERSISTENT
*/
151 /* SETTINGS
FOR FRAME F-Main
153 /* SETTINGS
FOR FILL-IN fil_CompanyName
IN FRAME F-Main
156 RECT-MASTER
:HIDDEN IN FRAME F-Main
= TRUE.
158 IF SESSION:DISPLAY-TYPE = "GUI":U
AND VALID-HANDLE(W-Win
)
159 THEN W-Win
:HIDDEN = yes.
161 /* _RUN-TIME-ATTRIBUTES-END
*/
168 /* ************************ Control Triggers
************************ */
170 &Scoped-define SELF-NAME W-Win
171 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-Win W-Win
172 ON CLOSE OF W-Win
/* Capital APMS Main Menu
*/
174 MESSAGE "Close" SESSION:IMMEDIATE-DISPLAY.
175 SESSION:IMMEDIATE-DISPLAY = No.
178 /* _UIB-CODE-BLOCK-END
*/
182 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-Win W-Win
183 ON END-ERROR
OF W-Win
/* Capital APMS Main Menu
*/
184 OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
185 /* This case occurs when the user presses the
"Esc" key.
186 In a persistently run window
, just ignore this. If we did not
, the
187 application would exit.
*/
188 IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
191 /* _UIB-CODE-BLOCK-END
*/
195 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-Win W-Win
196 ON WINDOW-CLOSE
OF W-Win
/* Capital APMS Main Menu
*/
198 /* This ADM code must be left here in order for the SmartWindow
199 and its descendents to terminate properly on exit.
*/
200 {&WINDOW-NAME}:HIDDEN = Yes.
201 APPLY "CLOSE":U
TO THIS-PROCEDURE.
205 /* _UIB-CODE-BLOCK-END
*/
209 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-Win W-Win
210 ON WINDOW-MAXIMIZED OF W-Win
/* Capital APMS Main Menu
*/
212 {&WINDOW-NAME}:WINDOW-STATE = WINDOW-NORMAL.
215 /* _UIB-CODE-BLOCK-END
*/
221 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK W-Win
224 /* *************************** Main Block
*************************** */
226 RUN start-splash-screen.
228 {&WINDOW-NAME}:VISIBLE = FALSE.
229 IF NOT VALID-HANDLE(sys-mgr
) THEN MESSAGE "sys-mgr not initialised".
230 RUN get-system-information
IN sys-mgr
( OUTPUT abbrev
, OUTPUT fil_CompanyName
,
231 OUTPUT icon-file
, OUTPUT bitmap-file
).
232 {&WINDOW-NAME}:VISIBLE = FALSE.
234 /* Include custom Main Block code for SmartWindows.
*/
235 {src
/adm
/template
/windowmn.i
}
237 /* _UIB-CODE-BLOCK-END
*/
241 /* ********************** Internal Procedures
*********************** */
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects W-Win _ADM-CREATE-OBJECTS
244 PROCEDURE adm-create-objects
:
245 /*------------------------------------------------------------------------------
246 Purpose
: Create handles for all SmartObjects used in this procedure.
247 After SmartObjects are initialized
, then SmartLinks are added.
249 ------------------------------------------------------------------------------*/
253 /* _UIB-CODE-BLOCK-END
*/
256 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available W-Win _ADM-ROW-AVAILABLE
257 PROCEDURE adm-row-available
:
258 /*------------------------------------------------------------------------------
259 Purpose
: Dispatched to this procedure when the Record-
260 Source has a new row available. This procedure
261 tries to get the new row
(or foriegn keys
) from
262 the Record-Source and process it.
264 ------------------------------------------------------------------------------*/
266 /* Define variables needed by this internal procedure.
*/
267 {src
/adm
/template
/row-head.i
}
269 /* Process the newly available records
(i.e. display fields
,
270 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
271 {src
/adm
/template
/row-end.i
}
275 /* _UIB-CODE-BLOCK-END
*/
278 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI W-Win _DEFAULT-DISABLE
279 PROCEDURE disable_UI
:
280 /*------------------------------------------------------------------------------
281 Purpose
: DISABLE the User Interface
283 Notes
: Here we clean-up the user-interface by deleting
284 dynamic widgets we have created and
/or hide
285 frames. This procedure is usually called when
286 we are ready to
"clean-up" after running.
287 ------------------------------------------------------------------------------*/
288 /* Delete the
WINDOW we created
*/
289 IF SESSION:DISPLAY-TYPE = "GUI":U
AND VALID-HANDLE(W-Win
)
290 THEN DELETE WIDGET W-Win.
291 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
294 /* _UIB-CODE-BLOCK-END
*/
297 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI W-Win _DEFAULT-ENABLE
298 PROCEDURE enable_UI
:
299 /*------------------------------------------------------------------------------
300 Purpose
: ENABLE the User Interface
302 Notes
: Here we display
/view
/enable the widgets in the
303 user-interface. In addition
, OPEN all queries
304 associated with each
FRAME and
BROWSE.
305 These statements here are based on the
"Other
306 Settings" section of the widget Property Sheets.
307 ------------------------------------------------------------------------------*/
308 DISPLAY fil_CompanyName
309 WITH FRAME F-Main
IN WINDOW W-Win.
311 WITH FRAME F-Main
IN WINDOW W-Win.
312 {&OPEN-BROWSERS-IN-QUERY-F-Main}
315 /* _UIB-CODE-BLOCK-END
*/
318 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-destroy W-Win
319 PROCEDURE inst-destroy
:
320 /*------------------------------------------------------------------------------
322 ------------------------------------------------------------------------------*/
323 SESSION:IMMEDIATE-DISPLAY = No.
327 /* _UIB-CODE-BLOCK-END
*/
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-create-controls W-Win
331 PROCEDURE local-create-controls
:
332 /*------------------------------------------------------------------------------
333 Purpose
: Override standard ADM method
335 ------------------------------------------------------------------------------*/
336 DEF VAR jurgen-hdl
AS HANDLE NO-UNDO.
338 /* Code placed here will execute PRIOR to standard behavior.
*/
340 /* Dispatch standard ADM method.
*/
341 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'create-controls'
:U
) .
343 /* Code placed here will execute AFTER standard behavior.
*/
344 RUN stop-splash-screen.
346 SESSION:IMMEDIATE-DISPLAY = No.
350 /* _UIB-CODE-BLOCK-END
*/
353 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-exit W-Win
354 PROCEDURE local-exit
:
355 /* -----------------------------------------------------------
356 Purpose
: Starts an
"exit" by APPLYing
CLOSE event
, which starts
"destroy".
358 Notes
: If activated
, should
APPLY CLOSE, *not
* dispatch adm-exit.
359 -------------------------------------------------------------*/
360 MESSAGE "local-exit" SESSION:IMMEDIATE-DISPLAY.
361 SESSION:IMMEDIATE-DISPLAY = No.
363 APPLY "CLOSE":U
TO THIS-PROCEDURE.
368 /* _UIB-CODE-BLOCK-END
*/
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE post-resize-window W-Win
372 PROCEDURE post-resize-window
:
373 /*------------------------------------------------------------------------------
374 Purpose
: Override the m-layout.i resize-window so that the window is
375 guaranteed to be big enough for img_mainmenu.
376 ------------------------------------------------------------------------------*/
377 DEF VAR x-min
AS INTEGER NO-UNDO.
378 DEF VAR y-min
AS INTEGER NO-UNDO.
380 OUTPUT TO VALUE( SESSION:TEMP-DIRECTORY + "/xxx.out" ) KEEP-MESSAGES.
381 MESSAGE "post-resize-window".
383 DO WITH FRAME {&FRAME-NAME}:
385 MESSAGE "post-resize-window a.0".
386 IF VALID-HANDLE(img_mainmenu
) THEN DO:
388 x-min
= img_mainmenu
:X + img_mainmenu
:WIDTH-PIXELS.
389 y-min
= img_mainmenu
:Y + img_mainmenu
:HEIGHT-PIXELS.
392 MESSAGE "post-resize-window a.1".
393 IF FRAME {&FRAME-NAME}:WIDTH-PIXELS < x-min THEN
394 FRAME {&FRAME-NAME}:WIDTH-PIXELS = x-min.
395 MESSAGE "post-resize-window b".
396 IF FRAME {&FRAME-NAME}:HEIGHT-PIXELS < y-min THEN
397 FRAME {&FRAME-NAME}:HEIGHT-PIXELS = y-min.
398 /* img_mainmenu
:HEIGHT-PIXELS = FRAME {&FRAME-NAME}:HEIGHT-PIXELS - img_mainmenu:Y. */
400 MESSAGE "post-resize-window c".
401 IF {&WINDOW-NAME}:WIDTH-PIXELS < x-min THEN
402 {&WINDOW-NAME}:WIDTH-PIXELS = x-min.
403 MESSAGE "post-resize-window d".
404 IF {&WINDOW-NAME}:HEIGHT-PIXELS < y-min THEN
405 {&WINDOW-NAME}:HEIGHT-PIXELS = y-min.
407 {&WINDOW-NAME}:X = (SESSION:WIDTH-PIXELS - (FRAME {&FRAME-NAME}:WIDTH-PIXELS)) / 2.
408 {&WINDOW-NAME}:Y = (SESSION:HEIGHT-PIXELS - (FRAME {&FRAME-NAME}:HEIGHT-PIXELS)) / 2.
410 MESSAGE "post-resize-window e".
411 {&WINDOW-NAME}:VISIBLE = TRUE.
412 {&WINDOW-NAME}:HIDDEN = FALSE.
413 SESSION:IMMEDIATE-DISPLAY = Yes.
418 /* OS-DELETE VALUE( SESSION:TEMP-DIRECTORY + "/xxx.out" ) .
*/
422 /* _UIB-CODE-BLOCK-END
*/
425 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-initialize W-Win
426 PROCEDURE pre-initialize
:
427 /*------------------------------------------------------------------------------
428 Purpose
: Start the window manager
431 ------------------------------------------------------------------------------*/
432 /* MESSAGE "pre-initialize".
*/
433 DO WITH FRAME {&FRAME-NAME}:
435 {&WINDOW-NAME}:VISIBLE = FALSE.
436 IF SESSION:SET-WAIT-STATE("") THEN .
440 /* _UIB-CODE-BLOCK-END
*/
443 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records W-Win _ADM-SEND-RECORDS
444 PROCEDURE send-records
:
445 /*------------------------------------------------------------------------------
446 Purpose
: Send record
ROWID's for all tables used by
448 Parameters
: see template
/snd-head.i
449 ------------------------------------------------------------------------------*/
451 /* SEND-RECORDS does nothing because there are no External
452 Tables specified for this SmartWindow
, and there are no
453 tables specified in any contained Browse
, Query
, or Frame.
*/
457 /* _UIB-CODE-BLOCK-END
*/
460 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE setup-environment W-Win
461 PROCEDURE setup-environment
:
462 /*------------------------------------------------------------------------------
466 ------------------------------------------------------------------------------*/
467 DEF VAR i
AS INT NO-UNDO.
468 DEF VAR j
AS INT NO-UNDO.
469 DEF VAR k
AS INT NO-UNDO.
471 j
= COLOR-TABLE:NUM-ENTRIES.
472 DEF VAR colors
AS INT EXTENT 64 NO-UNDO.
474 colors
[i
+ 1] = COLOR-TABLE:GET-RGB-VALUE(i
).
477 j
= FONT-TABLE:NUM-ENTRIES.
478 DEF VAR fonts
AS CHAR EXTENT 64 NO-UNDO.
479 DEF VAR font-string
AS CHAR NO-UNDO.
480 DEF VAR font-name
AS CHAR NO-UNDO.
482 font-name
= "Font" + TRIM(STRING(i
,">>9")).
483 GET-KEY-VALUE SECTION "Fonts" KEY font-name
VALUE font-string.
484 fonts
[i
+ 1] = font-string.
487 LOAD "apms" NO-ERROR.
490 j
= COLOR-TABLE:NUM-ENTRIES.
492 COLOR-TABLE:NUM-ENTRIES = 32.
494 COLOR-TABLE:SET-DYNAMIC( i
, TRUE ) NO-ERROR.
495 COLOR-TABLE:SET-RGB-VALUE( i
, colors
[i
+ 1]) NO-ERROR.
499 FIND RP
WHERE RP.UserName
= rem-user-name
500 AND RP.ReportID
= "Report Viewer" NO-LOCK NO-ERROR.
502 j
= FONT-TABLE:NUM-ENTRIES.
504 FONT-TABLE:NUM-ENTRIES = 35.
506 font-string
= fonts
[i
+ 1].
507 IF AVAILABLE(RP
) THEN DO:
508 IF i
= 28 AND RP.Char3
<> ?
THEN font-string
= RP.Char3.
509 IF i
= 29 AND RP.Char4
<> ?
THEN font-string
= RP.Char4.
511 font-name
= "Font" + TRIM(STRING(i
,">>9")).
512 PUT-KEY-VALUE SECTION "Fonts" KEY font-name
VALUE font-string
NO-ERROR.
519 /* _UIB-CODE-BLOCK-END
*/
522 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE start-splash-screen W-Win
523 PROCEDURE start-splash-screen
:
524 /*------------------------------------------------------------------------------
525 Purpose
: Start the splash screen.
528 ------------------------------------------------------------------------------*/
529 /* MESSAGE "start-splash-screen".
*/
531 IF remote-user
OR SEARCH( "win\w-splash.w" ) = ?
THEN DO:
536 DEF VAR wh-splash
AS HANDLE NO-UNDO.
538 RUN win\w-splash.w
PERSISTENT SET splash.
539 RUN dispatch
IN splash
( 'Initialize'
:U
).
543 /* _UIB-CODE-BLOCK-END
*/
546 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed W-Win
547 PROCEDURE state-changed
:
548 /* -----------------------------------------------------------
552 -------------------------------------------------------------*/
553 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
554 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
557 /* _UIB-CODE-BLOCK-END
*/
560 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE stop-splash-screen W-Win
561 PROCEDURE stop-splash-screen
:
562 /*------------------------------------------------------------------------------
566 ------------------------------------------------------------------------------*/
567 DEF VAR splash-win
AS HANDLE NO-UNDO.
569 /* MESSAGE "stop-splash-screen".
*/
571 IF splash
= ?
THEN RETURN.
572 splash-win
= splash
:CURRENT-WINDOW.
573 APPLY 'WINDOW-CLOSE'
:U
TO splash-win.
577 /* _UIB-CODE-BLOCK-END
*/
580 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE user-layout W-Win
581 PROCEDURE user-layout
:
582 /*------------------------------------------------------------------------------
584 ------------------------------------------------------------------------------*/
585 /* MESSAGE "user-layout".
*/
586 DO WITH FRAME {&FRAME-NAME}:
588 RUN set-window-icon
IN sys-mgr
( {&WINDOW-NAME} ).
589 {&WINDOW-NAME}:TITLE = abbrev + (IF abbrev <> "" THEN " " ELSE "") + "Capital APMS Main Menu".
591 /* OUTPUT TO VALUE( SESSION:TEMP-DIRECTORY + "/xxx.out" ) KEEP-MESSAGES.
*/
593 IF NOT remote-user
THEN DO:
594 CREATE IMAGE img_mainmenu
NO-ERROR
597 FRAME = FRAME {&FRAME-NAME}:HANDLE .
599 img_mainmenu
:LOAD-IMAGE( bitmap-file
).
600 FRAME {&FRAME-NAME}:WIDTH-PIXELS = img_mainmenu:WIDTH-PIXELS + 5.
601 FRAME {&FRAME-NAME}:HEIGHT-PIXELS = img_mainmenu:HEIGHT-PIXELS + 25.
603 RECT-MASTER
:WIDTH-PIXELS = img_mainmenu
:WIDTH-PIXELS - ( {&GAP} * 2 ).
604 RECT-MASTER
:HEIGHT-PIXELS = img_mainmenu
:HEIGHT-PIXELS - ( ({&GAP} + 24) * 3 ) + fil_CompanyName:HEIGHT-PIXELS.
608 /* MESSAGE "user-layout a".
*/
609 fil_CompanyName
:WIDTH-PIXELS = RECT-MASTER
:WIDTH-PIXELS - 25.
610 /* MESSAGE "user-layout b".
*/
612 RUN get-default-groups.
613 /* MESSAGE "user-layout c".
*/
614 RUN stack
( STRING( RECT-MASTER
:HANDLE ) + ",btn-group", "mst-group", "T", Yes
).
615 /* MESSAGE "user-layout d".
*/
617 /* img_mainmenu
:X = 0.
*/
618 /* NOTE
: the window size is set in post-resize-window
*/
620 /* OS-DELETE VALUE( SESSION:TEMP-DIRECTORY + "/xxx.out" ) .
*/
626 /* _UIB-CODE-BLOCK-END
*/