home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Cobol 24 Hours
/
Sams_Cobol_24_Hours.iso
/
Cobol32
/
PowerCBL
/
powercbl.Z
/
clock.prc
< prev
next >
Wrap
Text File
|
1997-03-13
|
4KB
|
131 lines
@POWER POWSHEET SHEET1 WORKING
* Define the screen size in pixels.
* The typical screen size for SVGA is
* 1024 pixels wide and 768 pixels high.
* The following settings are for VGA.
01 SCREEN-W GLOBAL PIC S9(4) COMP-5 VALUE 640.
01 SCREEN-H GLOBAL PIC S9(4) COMP-5 VALUE 480.
*
* Define the color maps for changing the background color.
*
01 COLOR-TABLE IS GLOBAL.
02 COLOR-ATTR.
03 FILLER PIC X(4) VALUE IS X"00000000".
03 FILLER PIC X(4) VALUE IS X"80000000".
03 FILLER PIC X(4) VALUE IS X"00800000".
03 FILLER PIC X(4) VALUE IS X"80800000".
03 FILLER PIC X(4) VALUE IS X"00008000".
03 FILLER PIC X(4) VALUE IS X"80008000".
03 FILLER PIC X(4) VALUE IS X"80808000".
02 COLORS REDEFINES COLOR-ATTR PIC X(4) OCCURS 7 TIMES.
*
* Define the colors for the background color.
01 COLOR-INDEX1 IS GLOBAL PIC S9(4) VALUE IS 0.
01 WK-COLOR IS GLOBAL PIC X(4).
*
* Define the geometric information for moving the sheet.
*
01 X-POS IS GLOBAL PIC S9(4) COMP-5 VALUE IS 0.
01 Y-POS IS GLOBAL PIC S9(4) COMP-5 VALUE IS 0.
01 MAX-X IS GLOBAL PIC S9(4) COMP-5 VALUE IS 0.
01 MAX-Y IS GLOBAL PIC S9(4) COMP-5 VALUE IS 0.
01 NEW-POSITION IS GLOBAL.
02 NEW-X PIC S9(4) COMP-5.
02 NEW-Y PIC S9(4) COMP-5.
02 NEW-W PIC S9(4) COMP-5.
02 NEW-H PIC S9(4) COMP-5.
@POWER POWSHEET SHEET1 OPENED
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CURR-POS.
02 CURR-X PIC S9(4) COMP-5.
02 CURR-Y PIC S9(4) COMP-5.
02 CURR-W PIC S9(4) COMP-5.
02 CURR-H PIC S9(4) COMP-5.
PROCEDURE DIVISION.
* Determine the upper-boundary of the zone that the sheet
* moves around in.
*
MOVE POW-POSITION OF SHEET1 TO CURR-POS.
COMPUTE MAX-X = SCREEN-W - CURR-W.
COMPUTE MAX-Y = SCREEN-H - CURR-H.
* Initialize the global data.
MOVE 0 TO CURR-X.
MOVE 0 TO CURR-Y.
MOVE 0 TO X-POS.
MOVE 0 TO Y-POS.
MOVE 0 TO NEW-X.
MOVE 0 TO NEW-Y.
MOVE CURR-W TO NEW-W.
MOVE CURR-H TO NEW-H.
* Move the sheet to the top left corner of the screen.
MOVE CURR-POS TO POW-POSITION OF SHEET1.
@POWER POWPSBTN PUSH1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WK-STATUS PIC S9(4) COMP-5.
PROCEDURE DIVISION.
* Alter the status of the timer.
IF POW-ACTIVATE OF TIMER1 = POW-ON THEN
MOVE POW-OFF TO WK-STATUS
MOVE "Restart" TO POW-TEXT OF PUSH1
MOVE "Stop" TO POW-TEXT OF LABEL1
ELSE
MOVE POW-ON TO WK-STATUS
MOVE "Stop" TO POW-TEXT OF PUSH1
MOVE "Restart" TO POW-TEXT OF LABEL1
END-IF
MOVE WK-STATUS TO POW-ACTIVATE OF TIMER1.
@POWER POWTIMER TIMER1 TIMER
* When the timer is started, move it around the screen and
* continuously change the background color.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
* Define the work area for getting the current time.
01 CURR-TIME.
02 CURR-HH PIC 99.
02 CURR-MM PIC 99.
02 CURR-SS PIC 99.
02 FILLER PIC 99.
* Define the string for POW-TEXT of LABEL1.
01 CURR-TIME-E.
02 CURR-HH PIC 99.
02 FILLER PIC X VALUE IS ":".
02 CURR-MM PIC 99.
02 FILLER PIC X VALUE IS ":".
02 CURR-SS PIC 99.
PROCEDURE DIVISION.
* Update the index of the color table in order to change the background color.
ADD 1 TO COLOR-INDEX1.
IF COLOR-INDEX1 > 7 THEN MOVE 1 TO COLOR-INDEX1.
* Change the background color.
MOVE COLORS (COLOR-INDEX1) TO WK-COLOR.
MOVE WK-COLOR TO POW-BACKCOLOR OF SHEET1.
* Keep the time display white against the colored background.
MOVE POW-WHITE TO POW-TEXTCOLOR OF LABEL1.
* Get the current time and display it in LABEL1.
ACCEPT CURR-TIME FROM TIME.
MOVE CORRESPONDING CURR-TIME TO CURR-TIME-E.
MOVE CURR-TIME-E TO POW-TEXT OF LABEL1.
* Begin moving the sheet around the screen.
ADD 10 TO X-POS.
IF X-POS > MAX-X THEN
MOVE 0 TO X-POS
ADD NEW-H TO Y-POS
IF Y-POS > MAX-Y THEN
MOVE 0 TO X-POS Y-POS
END-IF
END-IF
MOVE X-POS TO NEW-X.
MOVE Y-POS TO NEW-Y.
MOVE NEW-POSITION TO POW-POSITION OF SHEET1.
@POWER POWPSBTN PUSH2 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
* Close the sample application.
CALL CLOSESHEET OF SHEET1.