Consultor Eletrônico



Kbase 16615: Sample procedure to display current time during data entry
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Sample procedure to display current time during data entry

The following code demonstrates one way to display the current
system time during data entry. Note that there will be some
performance impact with this implementation.

This code does not work in character mode because of problems with
process events in TTY, it will only work with GUI.

/* Local Variable Definitions --- */

DEFINE VAR lEnd AS LOGICAL NO-UNDO INIT NO. /*** TIME CODE ***/

&Scoped-define FRAME-NAME DEFAULT-FRAME


/* *********************** Control Definitions ************* */

/* Definitions of the field level widgets */
DEFINE BUTTON Btn_Done DEFAULT
LABEL "&Done"
SIZE 12 BY 1.08
BGCOLOR 8 .

DEFINE VARIABLE FILL-IN-Char AS CHARACTER FORMAT "X(10)":U
LABEL "Character"
VIEW-AS FILL-IN
SIZE 14 BY 1 NO-UNDO.

DEFINE VARIABLE FILL-IN-Time AS CHARACTER FORMAT "X(256)":U
LABEL "Time"
VIEW-AS FILL-IN
SIZE 14 BY 1 NO-UNDO.

DEFINE FRAME DEFAULT-FRAME FILL-IN-Char FILL-IN-Time Btn_Done.

/* ************************ Control Triggers *************** */


ON WINDOW-CLOSE OF CURRENT-WINDOW /* <insert window title> */
DO:
/* This event will close the window and terminate the procedure. */
ASSIGN lEnd = YES. /*** TIME CODE ***/
APPLY "CLOSE":U TO THIS-PROCEDURE.
RETURN NO-APPLY.
END.

ON CHOOSE OF Btn_Done IN FRAME DEFAULT-FRAME /* Done */
DO:
ASSIGN lEnd = YES. /*** TIME CODE ***/
APPLY "CLOSE":U TO THIS-PROCEDURE.
END.

/* *************************** Main Block ****************** */

MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
/* RUN enable_UI.*/
ENABLE ALL WITH FRAME DEFAULT-FRAME.

DEFINE VAR iInc AS INT INIT 1 NO-UNDO. /*** TIME CODE ****/
DEFINE VAR iRefreshTime AS INT NO-UNDO.

/*** Define lEnd AND
Assign lEnd in Done Button and Close trigger ***/

pause 0 before-hide.

apply "entry" to fill-in-char.

ASSIGN iRefreshTime = TIME.
BL:
REPEAT ON ERROR UNDO BL, LEAVE BL
ON END-KEY UNDO BL, LEAVE BL:
IF iRefreshTime <= TIME THEN DO:
ASSIGN FILL-IN-Time:SCREEN-VALUE = STRING(iRefreshTime,"HH:MM:SS").
iRefreshTime = TIME + iInc.
END.

PROCESS EVENTS.

IF lEnd THEN LEAVE.
END. /*** TIME CODE *** */
/****
IF NOT THIS-PROCEDURE:PERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.
*****/
END.

References to other documentation:
KnowledgeBase Entry
13068 "PROCESS EVENTS IMMEDIATE DISPLAY MULTITASKING INTERVAL"
PROGRESS Language Reference Manual, PROCESS EVENTS

Progress Software Technical Support Note # 16615