home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_02_09
/
2n09018a
< prev
next >
Wrap
Text File
|
1991-07-31
|
6KB
|
134 lines
PICK.SECS FUNCTION (ACTION)
ACTION EXTERNAL
SCREEN, VARIABLES
EXCLUDED FROM LISTING
CODE
! SET SCREEN COLORS
SETHUE(STG:COLORS[SCR_SEC_KIND, SCR_TAB_TYPE, 1], |
STG:COLORS[SCR_SEC_KIND, SCR_TAB_TYPE, 2])
OPEN(SCREEN) !OPEN THE SCREEN
SETCURSOR !TURN OFF ANY CURSOR
NDX = 1 !PUT SELECTOR BAR ON TOP ITEM
ROW = ROW(?POINT) !REMEMBER TOP ROW AND
COL = COL(?POINT) !LEFT COLUMN OF SCROLL AREA
CLEAR_TAGS() !CLEAR TAG TABLE
SET(SEC:SYMBOL_KEY)
DO SHOW_TABLE
MAX = RECORDS(SEC:SYMBOL_KEY)
LOOP !LOOP UNTIL USER EXITS
IF MAX > COUNT THEN MAX = COUNT.!COUNT AND SCROLL ITEM COUNT
POINTER# = 0 !CLEAR POINTER
ALERT !RESET ALERTED KEYS
ALERT(REJECT_KEY) !ALERT SCREEN REJECT KEY
ALERT(ACCEPT_KEY) !ALERT SCREEN ACCEPT KEY
ALERT(ESC_KEY)
ACCEPT !READ A FIELD
IF ~RECORDS(SECURITY) !IF THERE ARE NO RECORDS
NO_RECS(ROW(?POINT),COL(?POINT)) ! SHOW MESSAGE
.
CASE KEYCODE() !PROCESS THE KEYSTROKE
OF REJECT_KEY
OROF ESC_KEY
OROF ACCEPT_KEY
BREAK !END LOOP
OF ENTER_KEY !ENTER KEY OR
DO GET_RECORD !SET TBLPTR
TAG_IT(POINTER(SECURITY)) !TAG THIS RECORD
DO SHOW_RECORD
SKIP(SECURITY,COUNT-NDX)
IF NDX < COUNT
NDX += 1 !AND MOVE DOWN ONE
ELSE
IF NOT EOF(SECURITY) !IF THERE ARE MORE RECORDS
SCROLL(ROW,COL,ROWS,COLS,ROWS(?POINT)) ! SCROLL UP
NEXT(SECURITY) !READ THE BOTTOM RECORD
DO SHOW_RECORD !AND DISPLAY IT
. .
OF DOWN_KEY !DOWN ARROW KEY
IF NOT EOF(SECURITY) !IF THERE ARE MORE RECORDS
SCROLL(ROW,COL,ROWS,COLS,ROWS(?POINT)) !SCROLL UP
NEXT(SECURITY) !READ THE BOTTOM RECORD
DO SHOW_RECORD !AND DISPLAY IT
.
OF PGDN_KEY !PAGE DOWN KEY
IF EOF(SECURITY) !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(SECURITY) !ON THE LAST PAGE
SET(SEC:SYMBOL_KEY) !SET TO BOTTOM RECORD MINUS
SKIP(SECURITY,-COUNT) !ONE PAGE OF RECORDS
DO SHOW_TABLE !DISPLAY THE LAST PAGE
.
OF UP_KEY !UP ARROW KEY
SKIP(SECURITY,-(COUNT-1)) !SET TO TOP RECORD MINUS 1
IF NOT BOF(SECURITY) !IF THERE IS A PRIOR RECORD
PREVIOUS(SECURITY) !READ THE TOP RECORD
IF NOT ERROR() !IF READ A RECORD
SCROLL(ROW,COL,ROWS,COLS,-(ROWS(?POINT)))!SCROLL DOWN
DO SHOW_RECORD !AND DISPLAY IT
. .
SKIP(SECURITY,COUNT-1) !SET RECORD FOR NEXT PAGE
OF PGUP_KEY !PAGE UP KEY
SKIP(SECURITY,-(COUNT-1)) !SET TO TOP RECORD MINUS ONE
IF BOF(SECURITY) !IF THERE IS NO PRIOR RECORD
NDX = 1 !THEN POINT TO TOP ITEM
SKIP(SECURITY,COUNT-1) !SET RECORD FOR THIS PAGE
ELSE !OTHERWISE
SKIP(SECURITY,-(COUNT+1)) !SET RECORD FOR PRIOR PAGE
DO SHOW_TABLE !AND DISPLAY THE PAGE
.
OF CTRL_PGUP !CTRL-PAGE UP
SET(SEC:SYMBOL_KEY) !SET TO FIRST RECORD
NDX = 1 !POINT TO TOP ITEM
DO SHOW_TABLE !AND DISPLAY THE PAGE
. .
SETHUE() !RESET COLORS
IF ANY_TAGS() THEN RETURN(ACT_DONE). !RETURN DONE IF ANY TAGGED
RETURN(ACTION) !NOT DONE IF NONE TAGGED
SHOW_TABLE ROUTINE !DISPLAY A PAGE OF RECORDS
SKIP(SECURITY,COUNT-1) !SET TO THE BOTTOM RECORD
IF EOF(SECURITY) !FOR A PARTIAL PAGE
SET(SEC:SYMBOL_KEY) !SET TO THE LAST RECORD
SKIP(SECURITY,-COUNT) !AND BACK UP ONE PAGE
ELSE !OTHERWISE
SKIP(SECURITY,-(COUNT-1)) !SET RECORD FOR THIS PAGE
.
NDX# = NDX !SAVE REPEAT INDEX
LOOP NDX = 1 TO COUNT !LOOP THRU THE SCROLL AREA
IF EOF(SECURITY) THEN BREAK. !BREAK ON END OF FILE
NEXT(SECURITY) !READ THE NEXT RECORD
DO SHOW_RECORD !AND DISPLAY IT
.
NDX = NDX#
IF RECORDS(SEC:SYMBOL_KEY) < COUNT !IF RECORDS DO NOT FILL
NDX#= RECORDS(SEC:SYMBOL_KEY)
BLANK(ROW + NDX#,COL,ROWS-NDX#,COLS) !BLANK REMAINING AREA
.
SHOW_RECORD ROUTINE !DISPLAY SCROLLING LINE
SCR:SYMBOL = SEC:SYMBOL
SCR:NAME = SEC:NAME
IF IS_TAG(POINTER(SECURITY)) !IF RECORD TAGGED,SHOW CHECK
SCR:TAG = '√'
ELSE
SCR:TAG = ' ' !RECORD NOT TAGGED,SHOW SPACE
.
GET_RECORD ROUTINE !READ SELECTED RECORD
SKIP(SECURITY,-(MAX-NDX+1)) !SET TO SELECTED RECORD
NEXT(SECURITY) !AND READ IT
SAME_PAGE ROUTINE !SET TO SAME PAGE ROUTINE
POINTER# = POINTER(SECURITY) !SAVE ITS RECORD POINTER
GET(SECURITY,POINTER#) !GET THE RECORD
SET(SEC:SYMBOL_KEY,SEC:SYMBOL_KEY) !SET TO THE SAME RECORD
SKIP(SECURITY,-1) !SKIP TO TOP OF SAME PAGE