home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
formtbl.zip
/
FORMTBL.MDL
< prev
Wrap
Text File
|
1989-07-06
|
29KB
|
765 lines
*TABLE1*************************************************************************
! ╔═════════════════════════════════════════════════════════╗
! ║ ║
! ║ ║
! ║ 06-15-89 John Crenshaw - EAS Technologies ║
! ║ Louisville, KY. 502-473-1000 ║
! ║ ║
! ║ ║
! ║ 06-23-89 Modified for 2008 JC ║
! ║ ║
! ║ ║
! ║ ║
! ║ Table 1 Calculates and passes current table row and ║
! ║ col to a form generated with the FORMTBL ║
! ║ model. The variables TBLROW and TBLCOL(byte)║
! ║ must have been declared earlier. I suggest ║
! ║ that you edit the global model and use it ║
! ║ to declare the 2 variables. ║
! ║ ║
! ╚═════════════════════════════════════════════════════════╝
@PROCNAME PROCEDURE
SCREEN SCREEN PRE(SCR),@SCREENOPT
@PAINTS
@STRINGS
@VARIABLES
ENTRY,USE(?FIRST_FIELD)
@FIELDS
@PREPOINT
REPEAT(@COUNT),EVERY(@PROWS),INDEX(NDX)
@PLOC POINT(@PROWS,@COLS),USE(?POINT),ESC(?-1)
@SCROLLVARIABLES
. .
TABLE TABLE !TABLE OF RECORD POINTERS
TBLPTR LONG ! POINTER TO DATA RECORD
.
NDX BYTE !REPEAT INDEX FOR POINT FIELD
ROW BYTE !ACTUAL ROW OF SCROLL AREA
COL BYTE !ACTUAL COLUMN OF SCROLL AREA
MAX LONG !LESSER OF COUNT AND RECORDS
COUNT BYTE(@COUNT) !NUMBER OF ITEMS TO SCROLL
ROWS BYTE(@ROWS) !NUMBER OF ROWS TO SCROLL
COLS BYTE(@COLS) !NUMBER OF COLUMNS TO SCROLL
EJECT
CODE
ACTION# = ACTION !SAVE ACTION
OPEN(SCREEN) !OPEN THE SCREEN
SETCURSOR !TURN OFF ANY CURSOR
@SETUP !CALL SETUP PROCEDURE
NDX = 1 !PUT SELECTOR BAR ON TOP ITEM
ROW = ROW(?POINT) !REMEMBER TOP ROW AND
COL = COL(?POINT) ! LEFT COLUMN OF SCROLL AREA
tblcol = col
IF ACTION = 4 !IF THIS IS A LOOKUP REQUEST
SET(@KEYNAME,@KEYNAME) ! FIND IT IN THE FILE
NEXT(@FILENAME) ! AND READ IT
POINTER# = POINTER(@FILENAME) ! SAVE POINTER TO CURRENT
SKIP(@FILENAME,-1) ! MAKE IT THE TOP RECORD
DO SHOW_TABLE ! FILL SCROLL AREA
GET(@FILENAME,POINTER#) ! AND REFRESH CURRENT RECORD
ELSE !OTHERWISE
SET(@KEYNAME) ! SET TO FIRST RECORD IN FILE
DO SHOW_TABLE ! FILL SCROLL AREA
.
RECORDS# = TRUE !INITIALIZE RECORDS FLAG
LOOP !LOOP UNTIL USER EXITS
MAX = RECORDS(@KEYNAME) !SET LESSER OF FILE RECORD
IF MAX > COUNT THEN MAX = COUNT. ! COUNT AND SCROLL ITEM COUNT
ACTION = ACTION# !RESTORE ACTION
POINTER# = 0 !CLEAR ADD POINTER
@LOOKUPS !DISPLAY FROM OTHER FILES
@SHOW !DISPLAY STRING VARIABLES
@COMPUTE !DISPLAY COMPUTED FIELDS
@CONDITIONAL
@RESULT !MOVE RESULTING VALUES
IF ~RECORDS(@KEYNAME) !IF THERE ARE NO RECORDS
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
ACTION = 1 ! SET ACTION TO ADD
tblrow = row(?point) ! JMC Insert first record
@AUTONUMKEY
@UPDATE ! CALL FORM FOR FIRST RECORD
@AUTONUMESC
IF ~RECORDS(@KEYNAME) THEN BREAK. ! IF ADD ABORTED THEN EXIT
SET(@KEYNAME) ! SET TO NEW RECORD
DO SHOW_TABLE ! FILL SCROLL AREA
NDX = 1 ! PUT SELECTOR BAR ON TOP ITEM
MAX = 1 ! MAXIMUM DISPLAYED IS 1
. !
ALERT !RESET ALERTED KEYS
ALERT(REJECT_KEY) !ALERT SCREEN REJECT KEY
ALERT(ACCEPT_KEY) !ALERT SCREEN ACCEPT KEY
! network model block added 09/15/88 by dmc
! adds <ctrl_e> to table for edit during lookup
ALERT (CTRL_E)
! end block added 09/15/88 by dmc
! network model block added 09/28/88 by dmc
! adds <ctrl_l> to table for auto-locate
ALERT (CTRL_L)
! end block added 09/28/88 by dmc
@ALERT !ALERT HOT KEY
ACCEPT !READ A FIELD
@TABLEHOT !ON HOT KEY, CALL PROCEDURE
IF KEYCODE() = REJECT_KEY THEN BREAK. !RETURN ON SCREEN REJECT KEY
EDIT_RANGE# = FIELD() !SET ONE FIELD EDIT RANGE
IF KEYCODE() = ACCEPT_KEY !ON SCREEN ACCEPT KEY
UPDATE ! MOVE ALL FIELDS FROM SCREEN
EDIT_RANGE# = ?POINT - 1 ! AND EDIT REMAINING FIELDS
SELECT(?POINT) ! IF OK THEN START HERE NEXT
. !
LOOP FIELD# = FIELD() TO EDIT_RANGE# !EDIT FIELDS IN THE EDIT RANGE
CASE FIELD# !JUMP TO FIELD EDIT ROUTINE
OF ?FIRST_FIELD !FROM THE FIRST FIELD
IF KEYCODE() = ESC_KEY OR | ! RETURN ON ESC KEY
RECORDS# = FALSE ! OR NO RECORDS
FREE(TABLE) ! FREE THE MEMORY TABLE
RETURN
.
@EDITS !EDIT ROUTINES GO HERE
RECORDS# = TRUE ! ASSUME RECORDS ARE HERE
@INITLOCATE !SHOW CURSOR FOR LOCATOR
OF ?POINT !FROM THE POINT FIELD
CASE KEYCODE() ! PROCESS THE KEYSTROKE
OF INS_KEY !INSERT KEY
action = 1
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
if records(table) >= count
tblrow = (count + row) -1
else
tblrow = records(table)+row
.
@AUTONUMKEY
@UPDATE ! CALL FORM FOR NEW RECORD
@AUTONUMESC
IF ~ACTION ! IF A NEW RECORD WAS ADDED
POINTER# = POINTER(@FILENAME) ! REMEMBER WHICH RECORD
SET(@KEYNAME,@KEYNAME) ! SET TO NEW RECORD AND
SKIP(@FILENAME,-1) ! MAKE IT THE TOP ITEM
DO SHOW_TABLE ! DISPLAY THAT PAGE
.
OF ENTER_KEY !ENTER KEY OR
OROF ACCEPT_KEY !CTRL ENTER KEY
DO GET_RECORD ! READ THE SELECTED RECORD
IF ERROR() ! IF RECORD HAS BEEN DELETED
MEM:MESSAGE = ERROR() ! TELL USER WHAT HAPPENED
SELECT(?) ! STAY IN THE POINT FIELD
DO SHOW_TABLE ! SHOW IT
BREAK ! AND GET ANOTHER KEY
.
IF ACTION = 4 ! IF THIS IS A LOOKUP REQUEST
ACTION = 0 ! SET ACTION TO COMPLETE
FREE(TABLE) ! FREE THE MEMORY TABLE
RETURN ! AND RETURN TO CALLER
. !
ACTION = 2 ! SET ACTION TO CHANGE
tblrow = row(?point)
@UPDATE ! CALL FORM TO CHANGE RECORD
IF ~ACTION ! IF THE RECORD WAS CHANGED
POINTER# = POINTER(@FILENAME) ! REMEMBER WHICH RECORD
SET(@KEYNAME,@KEYNAME) ! SET TO CHANGED RECORD
SKIP(@FILENAME,-1) ! MAKE IT THE TOP ITEM
DO SHOW_TABLE ! AND DISPLAY THAT PAGE
.
! network model block added 09/15/88 by dmc
! adds <ctrl_e> to table for edit during lookup
OF CTRL_E !ctrl-e key
DO GET_RECORD !read the selected record
ACTION# = ACTION !save action
ACTION = 2 !set action to change
tblrow = row(?point)
@UPDATE !CALL FORM TO CHANGE RE
IF ~ACTION !if the record was changed
POINTER# = POINTER(@FILENAME) !remember which record
SET(@KEYNAME,@KEYNAME) !set to changed record
SKIP(@FILENAME,-1) !make it the top item
DO SHOW_TABLE !and display that page
ELSE !otherwise
SKIP(@FILENAME,(MAX-NDX)) !skip back to same page
.
ACTION = ACTION# !restore action
! end block added 09/15/88 by dmc
OF DEL_KEY !DELETE KEY
DO GET_RECORD ! READ THE SELECTED RECORD
IF ERROR() ! IF RECORD HAS BEEN DELETED
MEM:MESSAGE = ERROR() ! TELL USER WHAT HAPPENED
SELECT(?) ! STAY IN THE POINT FIELD
DO SHOW_TABLE ! SHOW IT
BREAK ! AND GET ANOTHER KEY
.
ACTION = 3 ! SET ACTION TO DELETE
tblrow = row(?point)
@UPDATE ! CALL FORM TO DELETE RECORD
IF ~ACTION ! IF RECORD WAS DELETED
SKIP(@FILENAME,-NDX) ! SET NEXT RECORD ON TOP
DO SHOW_TABLE ! AND DISPLAY THAT PAGE
.
OF DOWN_KEY !DOWN ARROW KEY
IF NOT EOF(@FILENAME) ! IF THERE ARE MORE RECORDS
SCROLL(ROW,COL,ROWS,COLS,ROWS(?POINT)) ! SCROLL THE SCREEN UP
NEXT(@FILENAME) ! READ THE BOTTOM RECORD
GET(TABLE,1) ! GET THE TOP POINTER
DELETE(TABLE) ! REMOVE TOP ITEM
TBLPTR = POINTER(@FILENAME) ! DETERMINE RECORD POINTER
ADD(TABLE) ! ADD TO BOTTOM OF TABLE
DO SHOW_RECORD ! AND DISPLAY IT
.
OF PGDN_KEY !PAGE DOWN KEY
IF EOF(@FILENAME) ! ON THE LAST PAGE
NDX = MAX ! POINT TO BOTTOM ITEM
ELSE ! OTHERWISE
DO SHOW_TABLE ! DISPLAY NEXT PAGE
.
OF CTRL_PGDN !CTRL-PAGE DOWN KEY
NDX = MAX ! POINT TO BOTTOM ITEM
IF NOT EOF(@FILENAME) ! ON THE LAST PAGE
SET(@KEYNAME) ! SET TO BOTTOM RECORD MINUS
SKIP(@FILENAME,-COUNT) ! ONE PAGE OF RECORDS
DO SHOW_TABLE ! DISPLAY THE LAST PAGE
.
OF UP_KEY !UP ARROW KEY
SKIP(@FILENAME,-(COUNT-1)) ! SET TO TOP RECORD MINUS ONE
IF NOT BOF(@FILENAME) ! IF THERE IS A PRIOR RECORD
SCROLL(ROW,COL,ROWS,COLS,-(ROWS(?POINT))) ! SCROLL THE SCREEN DOWN
PREVIOUS(@FILENAME) ! READ THE TOP RECORD
GET(TABLE,RECORDS(TABLE)) ! GET THE LAST POINTER
DELETE(TABLE) ! REMOVE LAST ITEM
TBLPTR = POINTER(@FILENAME) ! DETERMINE RECORD POINTER
ADD(TABLE,1) ! ADD TO TOP OF TABLE
DO SHOW_RECORD ! AND DISPLAY IT
.
SKIP(@FILENAME,COUNT-1) ! SET RECORD FOR NEXT PAGE
OF PGUP_KEY !PAGE UP KEY
SKIP(@FILENAME,-(COUNT-1)) ! SET TO TOP RECORD MINUS ONE
IF BOF(@FILENAME) ! IF THERE IS NO PRIOR RECORD
NDX = 1 ! THEN POINT TO TOP ITEM
SKIP(@FILENAME,COUNT-1) ! SET RECORD FOR THIS PAGE
ELSE ! OTHERWISE
SKIP(@FILENAME,-(COUNT+1)) ! SET RECORD FOR PRIOR PAGE
DO SHOW_TABLE ! AND DISPLAY THE PAGE
.
OF CTRL_PGUP !CTRL-PAGE UP KEY
SET(@KEYNAME) ! SET TO FIRST RECORD
NDX = 1 ! POINT TO TOP ITEM
DO SHOW_TABLE ! AND DISPLAY THE PAGE
.
@LOCATE
. . .
FREE(TABLE) !FREE THE MEMORY TABLE
RETURN !RETURN TO CALLER
SHOW_TABLE ROUTINE !DISPLAY A PAGE OF RECORDS
FREE(TABLE) ! FREE THE MEMORY TABLE
SKIP(@FILENAME,COUNT-1) ! SET TO THE BOTTOM RECORD
IF EOF(@FILENAME) ! FOR A PARTIAL PAGE
SET(@KEYNAME) ! SET TO THE LAST RECORD
SKIP(@FILENAME,-COUNT) ! AND BACK UP ONE PAGE
ELSE ! OTHERWISE
SKIP(@FILENAME,-(COUNT-1)) ! SET RECORD FOR THIS PAGE
.
NDX# = NDX ! SAVE REPEAT INDEX
LOOP NDX = 1 TO COUNT ! LOOP THRU THE SCROLL AREA
IF EOF(@FILENAME) THEN BREAK. ! BREAK ON END OF FILE
NEXT(@FILENAME) ! READ THE NEXT RECORD
TBLPTR = POINTER(@FILENAME) ! GET THE RECORD NUMBER
ADD(TABLE) ! ADD IT TO THE TABLE
DO SHOW_RECORD ! AND DISPLAY IT
IF POINTER(@FILENAME) = POINTER# THEN NDX# = NDX.!POINT TO CORRECT RECORD
.
NDX = NDX# ! RESTORE REPEAT INDEX
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
IF RECORDS(@FILENAME) < COUNT ! IF RECORDS DO NOT FILL
NDX#= RECORDS(@FILENAME) * @PROWS ! GET NUMBER TIMES SIZE
BLANK(ROW + NDX#,COL,ROWS-NDX#,COLS) ! BLANK REMAINING AREA
.
SHOW_RECORD ROUTINE !DISPLAY A RECORD
@LOOKUPSCROLL ! DISPLAY FROM OTHER FILES
@SHOWSCROLL ! DISPLAY STRING VARIABLES
@COMPUTESCROLL ! DISPLAY COMPUTED FIELDS
GET_RECORD ROUTINE !READ SELECTED RECORD
GET(TABLE,NDX) ! GET THE TABLE RECORD
GET(@FILENAME,TBLPTR) ! GET THIS RECORD
FIND_RECORD ROUTINE !LOCATE REQUESTED RECORD
SET(@KEYNAME,@KEYNAME) ! SET TO REQUESTED RECORD
IF EOF(@FILENAME) ! IF BEYOND END OF FILE
PREVIOUS(@FILENAME) ! GET THE LAST RECORD
ELSE ! ELSE
NEXT(@FILENAME) ! READ THIS RECORD
.
POINTER# = POINTER(@FILENAME) ! SAVE ITS RECORD POINTER
SKIP(@FILENAME,-1) ! MAKE IT THE TOP RECORD
DO SHOW_TABLE ! AND FILL THE SCROLL AREA
SAME_PAGE ROUTINE !SET TO SAME PAGE ROUTINE
SKIP(@FILENAME,-NDX) ! SKIP TO TOP OF SAME PAGE
*SELTABLE1**********************************************************************
@PROCNAME PROCEDURE
! ╔═════════════════════════════════════════════════════════╗
! ║ ║
! ║ ║
! ║ 06-15-89 John Crenshaw - EAS Technologies ║
! ║ Louisville, KY. 502-473-1000 ║
! ║ ║
! ║ 06-23-89 Modified for 2008 JC ║
! ║ ║
! ║ ║
! ║ ║
! ║ Table 1 Calculates and passes current table row and ║
! ║ col to a form generated with the FORMTBL ║
! ║ model. The variables TBLROW and TBLCOL(byte)║
! ║ must have been declared earlier. I suggest ║
! ║ that you edit the global model and use it ║
! ║ to declare the 2 variables. ║
! ║ ║
! ╚═════════════════════════════════════════════════════════╝
SCREEN SCREEN PRE(SCR),@SCREENOPT
@PAINTS
@STRINGS
@VARIABLES
ENTRY,USE(?FIRST_FIELD)
@FIELDS
@PREPOINT
REPEAT(@COUNT),EVERY(@PROWS),INDEX(NDX)
@PLOC POINT(@PROWS,@COLS),USE(?POINT),ESC(?-1)
@SCROLLVARIABLES
. .
PTR LONG !ENTRY POINTER FOR KEY TABLE
NDX BYTE !REPEAT INDEX FOR POINT AREA
ROW BYTE !ACTUAL ROW OF SCROLL AREA
COL BYTE !ACTUAL COLUMN OF SCROLL AREA
COUNT BYTE(@COUNT) !NUMBER OF ITEMS TO SCROLL
ROWS BYTE(@ROWS) !NUMBER OF ROWS TO SCROLL
COLS BYTE(@COLS) !NUMBER OF COLUMNS TO SCROLL
TABLE TABLE !TABLE OF RECORD KEYS
TBLPTR LONG ! POINTER TO DATA RECORD
KEY GROUP,PRE(TBL) ! RECORD KEY FIELDS
@COMPONENTS
. .
@SAVEITEMS
EJECT
CODE
ACTION# = ACTION !SAVE ACTION
OPEN(SCREEN) !OPEN THE SCREEN
SETCURSOR !TURN OFF ANY CURSOR
@SETUP !CALL SETUP PROCEDURE
@INITSELECTS !SAVE SELECTOR FIELDS
PTR = 1 !START AT TABLE ENTRY
NDX = 1 !PUT SELECTOR BAR ON TOP ITEM
ROW = ROW(?POINT) !REMEMBER TOP ROW AND
COL = COL(?POINT) ! LEFT COLUMN OF SCROLL AREA
tblcol = col
RECORDS# = TRUE !INITIALIZE RECORDS FLAG
LOOP !LOOP UNTIL USER EXITS
ACTION = ACTION# !RESTORE ACTION
@RESTSELECTS !RESTORE SELECTOR FIELDS
@LOOKUPS !DISPLAY FROM OTHER FILES
@SHOW !DISPLAY STRING VARIABLES
@COMPUTE !DISPLAY COMPUTED FIELDS
@CONDITIONAL
@RESULT !MOVE RESULTING VALUES
ALERT !RESET ALERTED KEYS
ALERT(REJECT_KEY) !ALERT SCREEN REJECT KEY
ALERT(ACCEPT_KEY) !ALERT SCREEN ACCEPT KEY
@ALERT !ALERT HOT KEY
ACCEPT !READ A FIELD
MEM:MESSAGE = '' !CLEAR MESSAGE AREA
@TABLEHOT !ON HOT KEY, CALL PROCEDURE
IF KEYCODE() = REJECT_KEY THEN BREAK. !RETURN ON SCREEN REJECT KEY
EDIT_RANGE# = FIELD() !SET ONE FIELD EDIT RANGE
IF KEYCODE() = ACCEPT_KEY !ON SCREEN ACCEPT KEY
UPDATE ! MOVE ALL FIELDS FROM SCREEN
EDIT_RANGE# = ?POINT - 1 ! AND EDIT REMAINING FIELDS
SELECT(?POINT) ! IF OK THEN START HERE NEXT
. !
LOOP FIELD# = FIELD() TO EDIT_RANGE# !EDIT FIELDS IN THE EDIT RANGE
CASE FIELD# !JUMP TO FIELD EDIT ROUTINE
OF ?FIRST_FIELD !FROM THE FIRST FIELD
IF KEYCODE() = ESC_KEY OR | ! RETURN ON ESC KEY
RECORDS# = FALSE ! OR NO RECORDS
FREE(TABLE) ! FREE THE TABLE OF POINTS
RETURN ! RETURN TO CALLER
.
@EDITS !EDIT ROUTINES GO HERE
RECORDS# = TRUE ! ASSUME THERE ARE RECORDS
@INITLOCATE
OF ?POINT !PROCESS THE POINT FIELD
IF ~RECORDS(TABLE) !IF THERE ARE NO RECORDS
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
ACTION = 1 ! SET ACTION TO ADD
@AUTONUMKEY
UPDATE ! UPDATE ALL FIELDS
tblrow = row(?point)
@UPDATE ! CALL FORM FOR FIRST RECORD
IF ~ACTION ! IF RECORD WAS ADDED
DO ADD_TABLE ! THEN ADD NEW TABLE ENTRY
DO SORT_TABLE ! SORT THE TABLE
DO SHOW_TABLE ! AND DISPLAY FIRST PAGE
.
IF ~RECORDS(TABLE) ! IF ADD ABORTED TRY AGAIN
RECORDS# = FALSE ! INDICATE NO RECORDS
SELECT(?-1) ! SELECT PREVIOUS FIELD
BREAK ! END THE EDITS
.
CYCLE ! CONTINUE THE EDIT
.
CASE KEYCODE() !PROCESS THE KEYSTROKE
OF ENTER_KEY !ENTER KEY OR
OROF ACCEPT_KEY !CTRL-ENTER KEY
DO GET_RECORD ! READ THE SELECTED RECORD
IF ERROR() ! IF RECORD HAS BEEN DELETED
MEM:MESSAGE = ERROR() ! TELL USER WHAT HAPPENED
SELECT(?) ! STAY IN THE POINT FIELD
DO BUILD_TABLE ! REBUILD TABLE
DO SORT_TABLE ! SORT IT
DO SHOW_TABLE ! SHOW IT
BREAK ! AND GET ANOTHER KEY
.
IF ACTION = 4 AND KEYCODE() = ENTER_KEY ! IF THIS IS A LOOKUP REQUEST
ACTION = 0 ! SET ACTION TO COMPLETE
FREE(TABLE) ! FREE THE TABLE OF POINTS
RETURN ! RETURN TO CALLER
.
ACTION = 2 ! SET ACTION TO CHANGE
tblrow=row(?point)
@UPDATE ! CALL FORM TO CHANGE RECORD
IF ~ACTION ! IF THE RECORD WAS CHANGED
DELETE(TABLE) ! DELETE OLD TABLE ENTRY
DO ADD_TABLE ! ADD NEW TABLE ENTRY
DO SORT_TABLE ! SORT THE TABLE
DO SHOW_TABLE ! AND DISPLAY THAT PAGE
.
OF INS_KEY !INS KEY
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
ACTION = 1 ! SET ACTION TO ADD
if records(table) >= count
tblrow = (count + row) -1
else
tblrow = records(table) + row
.
@AUTONUMKEY
@UPDATE ! CALL FORM TO CHANGE RECORD
IF ~ACTION ! IF RECORD WAS ADDED
DO ADD_TABLE ! ADD NEW TABLE ENTRY
DO SORT_TABLE ! SORT THE TABLE
DO SHOW_TABLE ! AND DISPLAY THAT PAGE
.
OF DEL_KEY !DEL KEY
DO GET_RECORD ! READ THE SELECTED RECORD
IF ERROR() ! IF RECORD HAS BEEN DELETED
MEM:MESSAGE = ERROR() ! TELL USER WHAT HAPPENED
SELECT(?) ! STAY ON THE POINT FIELD
DO BUILD_TABLE ! REBUILD TABLE
DO SORT_TABLE ! SORT IT
DO SHOW_TABLE ! SHOW IT
BREAK ! AND GET ANOTHER KEY
.
ACTION = 3 ! SET ACTION TO DELETE
tblrow = row(?point)
@UPDATE ! CALL FORM TO DELETE RECORD
IF ~ACTION ! IF RECORD WAS DELETED
DELETE(TABLE) ! DELETE TABLE ENTRY
DO SHOW_TABLE ! AND DISPLAY THAT PAGE
.
OF DOWN_KEY !DOWN ARROW KEY
IF PTR <= RECORDS(TABLE)-COUNT ! IF THERE ARE MORE ENTRIES
SCROLL(ROW,COL,ROWS,COLS,ROWS(?POINT)) ! SCROLL THE SCREEN UP
PTR += 1 ! SET TO THE NEXT ENTRY
DO SHOW_RECORD ! AND DISPLAY THE RECORD
.
OF PGDN_KEY !PAGE DOWN KEY
IF PTR >= RECORDS(TABLE)-COUNT+1 ! ON THE LAST PAGE
NDX = COUNT. ! POINT TO BOTTOM ITEM
PTR += COUNT ! OTHERWISE
TBLPTR = -1 !INITIALIZE TO NO RECORD
DO SHOW_TABLE ! DISPLAY THE NEXT PAGE
OF CTRL_PGDN !CTRL-PAGE DOWN KEY
PTR = RECORDS(TABLE) - COUNT + 1 ! SET TO LAST PAGE
NDX = COUNT ! POINT TO BOTTOM ITEM
TBLPTR = -1 !INITIALIZE TO NO RECORD
DO SHOW_TABLE ! DISPLAY THE LAST PAGE
OF UP_KEY !UP ARROW KEY
IF PTR > 1 ! IF THERE IS A PRIOR RECORD
PTR -= 1 ! SET TO PRIOR RECORD
SCROLL(ROW,COL,ROWS,COLS,-(ROWS(?POINT)))! SCROLL THE SCREEN DOWN
DO SHOW_RECORD ! DISPLAY THE RECORD
.
OF PGUP_KEY !PAGE UP KEY
IF PTR = 1 THEN NDX = 1. ! ON FIRST PAGE POINT TO TOP
PTR -= ROWS ! OTHERWISE BACK UP 1 PAGE
TBLPTR = -1 !INITIALIZE TO NO RECORD
DO SHOW_TABLE ! AND DISPLAY IT
OF CTRL_PGUP !CTRL-PAGE UP
PTR = 1 ! POINT TO FIRST RECORD
NDX = 1 ! POINT TO TOP ITEM
TBLPTR = -1 !INITIALIZE TO NO RECORD
DO SHOW_TABLE ! AND DISPLAY THE FIRST PAGE
.
@LOCATE
. . . !
FREE(TABLE) !FREE MEMORY TABLE
RETURN !AND RETURN TO CALLER
BUILD_TABLE ROUTINE !BUILD MEMORY TABLE
FREE(TABLE) !EMPTY THE TABLE
CLEAR(@PRE:REcoRD)
@RESTSELECTS
UPDATE
@RESULT
@READTABLE !DO SELECTOR OR FILTER
TBLPTR = -1 !INITIALIZE TO NO RECORD
DO SHOW_TABLE !DISPLAY A PAGE OF RECORDS
ADD_TABLE ROUTINE !ADD ENTRY TO MEMORY TABLE
@CHECKADD !
IF ~(@FILTER) THEN EXIT. ! EXIT IF FILTERED OUT
@SETCOMPONENTS ! MOVE KEY COMPONENTS
TBLPTR = POINTER(@FILENAME) ! SAVE DATA RECORD POINTER
ADD(TABLE) ! ADD NEW TABLE ENTRY
IF ERROR() ! IF OUT OF MEMORY
MEM:MESSAGE = ERROR() ! INFORM USER
BEEP ! SOUND ALARM
.
SORT_TABLE ROUTINE !SORT TABLE ENTRIES
TBLPTR# = TBLPTR ! SAVE DATA RECORD POINTER
@SORTTABLE ! SORT THE TABLE
LOOP PTR = 1 TO RECORDS(TABLE) ! LOOK UP THE SAVED POINTER
GET(TABLE,PTR) ! SO WE WILL STILL POINT
IF TBLPTR = TBLPTR# THEN EXIT. ! AT THE SAME RECORD
.
SHOW_TABLE ROUTINE !DISPLAY A PAGE OF RECORDS
IF PTR > RECORDS(TABLE)-COUNT+1 ! FOR A PARTIAL PAGE
PTR = RECORDS(TABLE)-COUNT+1. ! SET TO THE LAST RECORD
IF PTR < 1 THEN PTR = 1. ! AND BACK UP ONE PAGE
TBLPTR# = TBLPTR ! SAVE DATA RECORD POINTER
NDX# = NDX ! SAVE REPEAT INDEX
LOOP NDX = 1 TO COUNT ! LOOP THRU THE SCROLL AREA
DO SHOW_RECORD ! DISPLAY A RECORD
IF TBLPTR# = TBLPTR THEN NDX# = NDX. ! POINT TO CORRECT RECORD
. !
NDX = NDX# ! RESTORE REPEAT INDEX
IF NDX > RECORDS(TABLE) THEN NDX = RECORDS(TABLE).!SHOWING THE LAST
CLEAR(@PRE:RECORD) ! CLEAR RECORD AREA
IF RECORDS(TABLE) < COUNT ! IF RECORDS DO NOT FILL
NDX#= RECORDS(TABLE) * @PROWS ! GET NUMBER TIMES SIZE
BLANK(ROW + NDX#,COL,ROWS-NDX#,COLS) ! BLANK REMAINING AREA
.
SHOW_RECORD ROUTINE !DISPLAY A RECORD
TBLPTR = 0 ! START WITH NO RECORD
GET(TABLE,PTR+NDX-1) ! GET THE TABLE ENTRY
IF ~ERROR() ! IF THERE IS ONE
GET(@FILENAME,TBLPTR) ! READ A DATA RECORD
IF ~ERROR()
@RESTSELECTS ! RESTORE SELECTOR FIELDS
@LOOKUPSCROLL ! DISPLAY FROM OTHER FILES
@SHOWSCROLL ! DISPLAY STRING VARIABLES
@COMPUTESCROLL ! DISPLAY COMPUTED FIELDS
. .
GET_RECORD ROUTINE !READ SELECTED RECORD
GET(TABLE,PTR+NDX-1) ! GET THE TABLE ENTRY
GET(@FILENAME,TBLPTR) ! READ THE DATA RECORD
FIND_RECORD ROUTINE !LOCATE REQUESTED RECORD
@SETCOMPONENTS ! MOVE THEM TO THE TABLE
GET(TABLE,KEY) ! GET THE TABLE ENTRY
PTR = POINTER(TABLE) ! SET RECORD POINTER
IF ~PTR THEN PTR = RECORDS(TABLE). ! SET TO LAST IF NO POINTER
GET(TABLE,PTR) ! AND READ THE DATA RECORD
DO SHOW_TABLE ! DISPLAY THAT PAGE
SAME_PAGE ROUTINE !SET TO SAME PAGE ROUTINE
DO SORT_TABLE ! SORT THE TABLE
*FORMTBL************************************************************************
@PROCNAME PROCEDURE
! ╔═════════════════════════════════════════════════════════╗
! ║ ║
! ║ ║
! ║ 06-15-89 John Crenshaw - EAS Technologies ║
! ║ Louisville, KY. 502-473-1000 ║
! ║ ║
! ║ 06-23-89 Modified for 2008 ║
! ║ ║
! ║ 07-06-89 Fixed bug in model on action 3 in network ║
! ║ pointer# is set to 0 giveing a Record ║
! ║ not available error. ║
! ║ ║
! ║ ║
! ║ ║
! ║ Uses the variables TBLROW and TBLCOL passed ║
! ║ from TABLE1, TABLESEL1, and SELTABLE1 to open ║
! ║ a from that appears to allow editing on the ║
! ║ table. ║
! ║ ║
! ╚═════════════════════════════════════════════════════════╝
SCREEN SCREEN at(tblrow,tblcol),PRE(SCR),@SCREENOPT
@PAINTS
@STRINGS
@VARIABLES
ENTRY,USE(?FIRST_FIELD)
@FIELDS
@PAUSE
ENTRY,USE(?LAST_FIELD)
PAUSE(''),USE(?DELETE_FIELD)
.
SAVE_RECORD GROUP;BYTE,DIM(SIZE(@PRE:RECORD)).
SAVE_MEMO GROUP;BYTE,DIM(SIZE(@MEMO)).
MSG string(80)
EJECT
CODE
OPEN(SCREEN) !OPEN THE SCREEN
SETCURSOR !TURN OFF ANY CURSOR
! network model block changed 09/15/88 by dmc
! moved @setup before save_record & save_memo equates
! to solve 'changed by another station' message
! display when get(filename,1);action=2
! is used to load the single record in a system file
! for edit.
@SETUP !CALL SETUP PROCEDURE
SAVE_RECORD = @PRE:RECORD !SAVE THE ORIGINAL
SAVE_MEMO = @MEMO !SAVE THE ORIGINAL
! END BLOCK CHANGED 09/15/88 BY DMC
DISPLAY !DISPLAY THE FIELDS
EXECUTE ACTION !SET THE CURRENT RECORD POINTER
POINTER# = 0 ! NO RECORD FOR ADD
POINTER# = POINTER(@FILENAME) ! CURRENT RECORD FOR CHANGE
POINTER# = POINTER(@FILENAME) ! CURRENT RECORD FOR CHANGE
.
LOOP !LOOP THRU ALL THE FIELDS
MSG = CENTER(clip(MEM:MESSAGE),80) !DISPLAY ACTION MESSAGE
sethue(4,7)
show(25,1,msg)
sethue()
@LOOKUPS !DISPLAY FROM OTHER FILES
@SHOW !DISPLAY STRING VARIABLES
@COMPUTE !DISPLAY COMPUTED FIELDS
@CONDITIONAL
@RESULT !MOVE RESULTING VALUES
ALERT !RESET ALERTED KEYS
ALERT(ACCEPT_KEY) !ALERT SCREEN ACCEPT KEY
ALERT(REJECT_KEY) !ALERT SCREEN REJECT KEY
@ALERT !ALERT HOT KEY
ACCEPT !READ A FIELD
@CHECKHOT !ON HOT KEY, CALL PROCEDURE
IF KEYCODE() = REJECT_KEY THEN RETURN. !RETURN ON SCREEN REJECT KEY
EXECUTE ACTION !SET ACTION MESSAGE
MEM:MESSAGE = 'Creating New Record' !
MEM:MESSAGE = 'Changing Existing Record' !
MEM:MESSAGE = 'Press Enter to Delete' !
.
EDIT_RANGE# = FIELD() !SET ONE FIELD EDIT RANGE
IF KEYCODE() = ACCEPT_KEY !ON SCREEN ACCEPT KEY
UPDATE ! MOVE ALL FIELDS FROM SCREEN
EDIT_RANGE# = FIELDS() ! AND EDIT REMAINING FIELDS
. !
LOOP FIELD# = FIELD() TO EDIT_RANGE# !EDIT FIELDS IN THE EDIT RANGE
CASE FIELD# !JUMP TO FIELD EDIT ROUTINE
OF ?FIRST_FIELD !FROM THE FIRST FIELD
IF KEYCODE() = ESC_KEY ! RETURN ON ESC KEY
msg=all(' ',80) !JMC blank 25th line
show(25,1,msg)
RETURN
.
IF ACTION = 3 THEN SELECT(?DELETE_FIELD).! OR CONFIRM FOR DELETE
@EDITS !EDIT ROUTINES GO HERE
OF ?LAST_FIELD !FROM THE LAST FIELD
IF ACTION = 2 OR ACTION = 3 !IF UPDATEING RECORD
HOLD(@FILENAME) ! HOLD FILE
GET(@FILENAME,POINTER#) ! RE-READ SAME RECORD
IF ERRORCODE() = 35 ! IF RECORD WAS DELETED
IF ACTION = 2
ACTION = 1
ELSE !
RELEASE(@FILENAME) ! RELEASE FILE
ACTION = 0 ! TURN OFF ACTION
.
ELSIF | ! IF IT HAS BEEN CHANGED
@MEMO <> SAVE_MEMO OR | !
@PRE:RECORD <> SAVE_RECORD ! BY ANOTHER STATION
MEM:MESSAGE = 'CHANGED BY ANOTHER STATION' !INFORM USER
SELECT(2) ! GO BACK TO FIELD 1
BEEP ! SOUND ALARM
RELEASE(@FILENAME) ! RELEASE FILE
SAVE_RECORD = @PRE:RECORD ! SAVE RECORD
SAVE_MEMO = @MEMO ! SAVE MEMO
DISPLAY ! DISPLAY THE FIELDS
BREAK ! AND CONTINUE
.
UPDATE !UPDATE FROM SCREEN TO RECORD
@RESULT !MOVE RESULTING VALUES
.
EXECUTE ACTION ! UPDATE THE FILE
ADD(@FILENAME) ! ADD NEW RECORD
PUT(@FILENAME) ! CHANGE EXISTING RECORD
DELETE(@FILENAME) ! DELETE EXISTING RECORD
.
if action = 3 or action = 2
release(@filename)
.
IF ERROR() THEN STOP(ERROR()). ! CHECK FOR UNEXPECTED ERROR
PUT(@FILENAME2) ! UPDATE SECONDARY FILES
PUT(@FILENAME3) ! UPDATE SECONDARY FILES
PUT(@FILENAME4) ! UPDATE SECONDARY FILES
IF ACTION = 1 THEN POINTER# = POINTER(@FILENAME). !POINT TO RECORD
SAVE_RECORD = @PRE:RECORD ! NEW ORIGINAL
SAVE_MEMO = @MEMO ! NEW ORIGINAL
ACTION = ACTION#
@NEXTFORM ! CALL NEXT FORM PROCEDURE
ACTION = 0 ! SET ACTION TO COMPLETE
msg=all(' ',80) !JMC blank 25th line
show(25,1,msg)
RETURN ! AND RETURN TO CALLER
OF ?DELETE_FIELD !FROM THE DELETE FIELD
IF KEYCODE() = ENTER_KEY | ! ON ENTER KEY
OR KEYCODE() = ACCEPT_KEY ! OR CTRL-ENTER KEY
SELECT(?LAST_FIELD) ! DELETE THE RECORD
ELSE ! OTHERWISE
BEEP ! BEEP AND ASK AGAIN
. . . .