home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
WNDTOOL5.ZIP
/
POPLIST.SUB
< prev
next >
Wrap
Text File
|
1989-04-26
|
28KB
|
794 lines
'
'$PAGE
'
'******************************************************************************
' Function : *
' *
' Purpose: *
' *
' *
' Results: *
' *
' Usage : *
' *
' *
' Date Written : 01/01/89 - Date Tested: 01/01/89 - Author: James P Morgan *
' Date Modified: - : - : *
'-----------------------------------------------------------------------------*
' NOTE: *
'******************************************************************************
' *
' SUB PROGRAM NAME (PARAMETERS) STATIC/RECURSIVE *
'-----------------------------------------------------------------------------*
' *
'============================================================================
'
SUB POPLIST(HEADER$,SHOWITEMS%,MAXITEMS%,ITEM$(1),FORE%,BACK%,HFORE%,HBACK%,QUADRANT$,SHADOW%,SELECT.%) STATIC
DEFINT A-Z 'make all short intergers by default
SELECT.BASE=1 'normalize
TEMP.ITEM$=STRING$(255," ")
ITEM.MIN=LBOUND(ITEM$) 'adjust for callers OPTION BASE
BEGVAL=1
MENU.TOP.ROW=0
MENU.TOP.LEFT.COL=0
MENU.BOTTOM.ROW=0
MENU.BOTTOM.RIGHT.COL=0
BUTTONS%=0 'assume no mouse support avail
CALL MMCHECK(BUTTONS%) 'see if mouse support avail
GOSUB POPLIST.MMCURSORON
MOUSECOL=0 'locate the mouse cursor in upper
MOUSEROW=0 'left top corner of screen
CALL MMSETLOC(MOUSECOL,MOUSEROW) 'move the mouse cursor
GOSUB POPLIST.MMCURSOROFF
IF SHOWITEMS%> MAXITEMS% THEN 'we cant show more than whats avail
SHOWITEMS%=MAXITEMS%
ENDIF
'
WINDLEN=LEN(HEADER$) 'assume window length is header length
'Determine width of window from length of longest item
J.BASE=1
FOR J=J.BASE TO MAXITEMS%
J.SUB=(J-J.BASE)+ITEM.MIN
IF LEN(ITEM$(J.SUB)) > WINDLEN THEN
WINDLEN=LEN(ITEM$(J.SUB))
ENDIF
NEXT
LENGTH.MENU.ITEM=WINDLEN 'this is the length of the longest item
'If Quadrant is in ROW:COL format, extract Row and Column
IF INSTR(QUADRANT$,":")<>0 THEN 'was an absolute row:column specified
GOSUB POPLIST.GETORD
GOTO POPLIST.GO1
ENDIF
'Determine Position based on Quadrant Parameter and size of menu
QUADRANT=VAL(QUADRANT$) 'The window is to be in 1 of the 5 quadrants
IF QUADRANT <0 OR QUADRANT >4 THEN 'make sure the quadrant is valid
QUADRANT=0 'if invalid, default to center of screen
ENDIF
CALL SETQUAD(QUADRANT,CROW,CCOL,WINDLEN,SHOWITEMS%)
ULR%=CROW-(((SHOWITEMS%+2)/2)-.5) 'the upper left row:column window co-ordinates
ULC%=CCOL-((WINDLEN/2)-.5)
LRR=ULR%+SHOWITEMS%+1 'the lower right window co-ordinates
LRC=ULC%+WINDLEN-1
'
'Create Window for List
POPLIST.GO1:
MENU.TOP.ROW=ULR%+2 'allow for the menu name box above the window
MENU.TOP.LEFT.COL=ULC%
MENU.BOTTOM.ROW=LRR
MENU.BOTTOM.RIGHT.COL=LRC
FRAME%=4
CALL MAKEWIND(ULR%,ULC%,LRR,LRC,FRAME,FORE%,BACK%,GROW,SHADOW%,LABEL$)
TEMPHDR$=SPACE$(WINDLEN) 'make menu header as big as biggest item
IF LEN(HEADER$)<>WINDLEN THEN 'does the menu header need centering?
GOSUB POPLIST.PUTHDR 'YES
ENDIF
ATTR=(HBACK% AND 7)*16+HFORE% 'display the menu header
ROW=ULR%
COL=ULC%
CALL FASTPRT(HEADER$,ROW,COL,ATTR)
ATTR=(BACK% AND 7)*16+FORE% 'bracket the menu header in the window
ROW=ULR%+1
COL=ULC%
DAT$=STRING$(WINDLEN,205)
CALL FASTPRT(DAT$,ROW,COL,ATTR)
'Set current choice to List Item #1, Set Beginning and Ending values,
'Display 'More...' message and enter Loop
IF (SELECT.%<1) OR (SELECT.%>MAXITEMS%) THEN 'is first item to be displayed valid range?
SELECT.%=1 'NO, so display first one by default
ENDIF
FIRST.SELECT=SELECT.% 'remember the first item to display
SELECT.%=1 'display the first group of items
BEGVAL=SELECT.% 'starting with the first item
ENDVAL=SHOWITEMS% 'and ending with the max we can display at once
GOSUB POPLIST.FILL
IF FIRST.SELECT<>1 THEN 'do we really want to display another item first?
TEMP.SELECT=FIRST.SELECT 'yes, make it so
GOSUB POPLIST.FOUND.IT
ENDIF
'
POPLIST.LOOP:
GOSUB POPLIST.PRESS 'Get KeyPress
IF KP$=CHR$(13) OR KP$=CHR$(27) THEN 'was Enter or ESC key pressed?
GOTO POPLIST.DONE 'yes, were are thru
ENDIF
GOTO POPLIST.LOOP 'keep waiting for user to press a key
'
'Check for KeyPress and sound error if not UP ARROW, DOWN ARROW, HOME, END, PAGE UP, PAGE DOWN, or RETURN
POPLIST.PRESS:
GOSUB POPLIST.MMCURSORON
CALL MMGETLOC(MOUSECOL,MOUSEROW)
CALL MMCLICK(LFT%,RGT%) 'flush any mouse clicks
GOSUB POPLIST.GET.PRESS
IF KP$="" THEN 'wait for a key or mouse click
GOTO POPLIST.PRESS
ENDIF
IF LEN(KP$)=2 THEN 'was an extended function key pressed?
GOTO POPLIST.DOWN 'yes
ENDIF
POPLIST.PRESS.ON:
IF KP$=CHR$(13) THEN 'Enter key pressed?
RETURN
ENDIF
IF KP$=CHR$(27) THEN 'ESC key pressed
SELECT.%=0 'nothing noted as being selected
RETURN
ENDIF
GOSUB POPLIST.FIND.OPTION 'find the first char of an item that matches key pressed
IF SELECT.%<>SAVE.SELECT THEN 'was a new item found?
RETURN 'YES
ENDIF
GOSUB POPLIST.SOUNDOFF 'NO, a new item not found!
GOTO POPLIST.PRESS
'
'Process DOWN ARROW KeyPress
POPLIST.DOWN:
IF ASC(RIGHT$(KP$,1))=80 THEN 'was cursor down key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=SELECT.%+1 'this is the new item we want highlighted
ELSE
GOTO POPLIST.UP 'NO, see if cursor up
ENDIF
IF SELECT.% > MAXITEMS% THEN 'are we at the end of the items?
IF SHOWITEMS%=MAXITEMS% THEN 'is this a POPMENU
BEGVAL=1 'loop back to top of menu items
OLD=MAXITEMS% 'point to current item highlighted
SELECT.%=1 'point to next item to highlight
ENDVAL=MAXITEMS% 'point to last menu item to display
GOSUB POPLIST.FILL
RETURN
ELSE
SELECT.% = MAXITEMS% 'cant go past the end!
GOSUB POPLIST.SOUNDOFF
ENDIF
ENDIF
IF (SELECT.% > ENDVAL) AND (SELECT.% = MAXITEMS%) THEN
BEGVAL=BEGVAL+1
ENDVAL=ENDVAL+1
GOSUB POPLIST.FILL
RETURN
ENDIF
'
' have we requested an item on the next screen of items
'
IF (SELECT.% > ENDVAL) AND (SELECT.% <> MAXITEMS%) THEN
BEGVAL=BEGVAL+1
ENDVAL=ENDVAL+1
GOSUB POPLIST.FILL
RETURN
ENDIF
'
' highlight the next item
GOSUB POPLIST.FILL
RETURN
'
'Process UP ARROW KeyPress
POPLIST.UP:
IF ASC(RIGHT$(KP$,1))=72 THEN 'was cursor up key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=SELECT.%-1 'this is the new item we want highlighted
ELSE
GOTO POPLIST.PG.UP 'NO, see if page up
ENDIF
IF SELECT.% < 1 THEN 'are we at the top of the items?
IF SHOWITEMS%=MAXITEMS% THEN 'is this a POPMENU
BEGVAL=1 'loop back to bottom of menu items
OLD=1 'point to current highlighted item
SELECT.%=MAXITEMS% 'point to next item to highlight
ENDVAL=MAXITEMS% 'point to last item to display
GOSUB POPLIST.FILL
RETURN
ELSE
SELECT.% = 1 'cant go past the top!
GOSUB POPLIST.SOUNDOFF
ENDIF
ENDIF
IF (SELECT.% < BEGVAL) AND (SELECT.% = 1) THEN
BEGVAL=BEGVAL-1
ENDVAL=ENDVAL-1
GOSUB POPLIST.FILL
RETURN
ENDIF
'
' have we requested an item on the next screen of items
'
IF (SELECT.% < BEGVAL) AND (SELECT.% <> 1) THEN
BEGVAL=BEGVAL-1
ENDVAL=ENDVAL-1
GOSUB POPLIST.FILL
RETURN
ENDIF
'
' highlight the next item
GOSUB POPLIST.FILL
RETURN
'
'Process PAGE UP KeyPress
POPLIST.PG.UP:
IF ASC(RIGHT$(KP$,1))=73 THEN 'was page up key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=SELECT.%-SHOWITEMS% 'this is the new item we want highlighted
ELSE
GOTO POPLIST.PG.DN 'NO, see if cursor down
ENDIF
IF SELECT.% < 1 THEN 'are we at the first screen of items?
KP$=CHR$(0)+CHR$(79) 'simulate a END key press
SELECT.%=OLD
GOTO POPLIST.ENDK
ENDIF
BEGVAL=BEGVAL-SHOWITEMS% 'calculate the first and last items in next screen
ENDVAL=ENDVAL-SHOWITEMS%
IF BEGVAL < 1 THEN 'we cant go past first item
BEGVAL=1 'point to first item
ENDVAL=SHOWITEMS%
ENDIF
GOSUB POPLIST.FILL 'highlight the item
RETURN
'Process PAGE DOWN KeyPress
POPLIST.PG.DN:
IF ASC(RIGHT$(KP$,1))=81 THEN 'was page down key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=SELECT.%+SHOWITEMS% 'this is the new item we want highlighted
ELSE
GOTO POPLIST.HOME 'NO, see if home pressed
ENDIF
IF SELECT.% > MAXITEMS% THEN 'are we at the last screen of items?
KP$=CHR$(0)+CHR$(71) 'simulate a HOME key press
SELECT.%=OLD
GOTO POPLIST.HOME
ENDIF
BEGVAL=BEGVAL+SHOWITEMS% 'calculate the first and last items in next screen
ENDVAL=ENDVAL+SHOWITEMS%
IF ENDVAL > MAXITEMS% THEN 'we cant go past the last item
ENDVAL=MAXITEMS% 'point to last item
BEGVAL=ENDVAL-SHOWITEMS%+1
ENDIF
GOSUB POPLIST.FILL 'highlight the item
RETURN
'
'Process HOME KeyPress
POPLIST.HOME:
IF ASC(RIGHT$(KP$,1))=71 THEN 'was home key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=1 'display the first group of items
ELSE
GOTO POPLIST.ENDK 'NO, see if end key pressed
ENDIF
BEGVAL=1 'point to the first item
ENDVAL=BEGVAL+SHOWITEMS%-1 'and display the first screen of this many items
GOSUB POPLIST.FILL
RETURN
'
'Process END KeyPress
POPLIST.ENDK:
IF ASC(RIGHT$(KP$,1))=79 THEN 'was end key pressed?
OLD=SELECT.% 'this is the current item highlighted
SELECT.%=MAXITEMS% 'display the last group of items
ELSE
GOTO POPLIST.ERRCHK 'NO, let user know invalid key pressed
ENDIF
ENDVAL=MAXITEMS% 'point to the last item
BEGVAL=ENDVAL-SHOWITEMS%+1 'display screen of last group of items
GOSUB POPLIST.FILL
RETURN
'
'Process ERROR
POPLIST.ERRCHK:
GOSUB POPLIST.SOUNDOFF 'let user know problem/error
GOTO POPLIST.PRESS
'
'Fill Contents of window
POPLIST.FILL:
IF BEGVAL < 1 THEN 'make sure we dont go out of bounds
BEGVAL=1
ENDIF
IF ENDVAL > MAXITEMS% THEN 'make sure we dont go past the end of the items
ENDVAL=MAXITEMS%
ENDIF
OFFSET=ENDVAL-SELECT.%
IF OFFSET < 0 THEN
OFFSET = 0
ELSEIF OFFSET > SHOWITEMS%-1 THEN
OFFSET = SHOWITEMS%-1
ENDIF
GOSUB POPLIST.MMCURSOROFF
K=1
J.BASE=1
'
' display the group of items we need
'
FOR J=BEGVAL TO ENDVAL
ATTR=(BACK% AND 7)*16+FORE%
ROW=(ULR%+1+K)
COL=ULC%
DAT$=ITEM$((J-J.BASE)+ITEM.MIN)
IF LEN(DAT$)<WINDLEN THEN
DAT$=DAT$+STRING$(WINDLEN-LEN(DAT$)," ")
ENDIF
CALL FASTPRT(DAT$,ROW,COL,ATTR)
K=K+1
NEXT
'
'highlight the next item displayed
ATTR=(FORE% AND 7)*16+BACK%
IF BEGVAL=1 AND SELECT.%=1 THEN
ROW=ULR%+2
ELSEIF (SELECT.% >= BEGVAL) AND (SELECT.% <= ENDVAL) THEN
ROW=ULR%+2+SELECT.%
ENDIF
IF (ENDVAL=MAXITEMS%) AND (SELECT.%=MAXITEMS%) THEN
ROW=LRR
ELSE
ROW=LRR-OFFSET
ENDIF
COL=ULC%
DAT$=ITEM$((SELECT.%-SELECT.BASE)+ITEM.MIN)
IF LEN(DAT$)<WINDLEN THEN
DAT$=DAT$+STRING$(WINDLEN-LEN(DAT$)," ")
ENDIF
'
' display this selected item, and highlight it
CALL FASTPRT(DAT$,ROW,COL,ATTR)
MOUSEROW=(ROW-1)*8 'if so, put the mouse cursor on the new selection
MOUSECOL=(COL+(LEN(DAT$)\2)-1)*8
CALL MMSETLOC(MOUSECOL,MOUSEROW)
GOSUB POPLIST.MORE 'put arrows on top and bottom of window
RETURN
'
'Display arrowhead on top or bottom of window as necessary
POPLIST.MORE:
IF SHOWITEMS%=MAXITEMS% THEN 'are we doing POPMENU
RETURN 'yes, all items displayed at once
ENDIF
MCOL=ULC%+((LRC-ULC%)/2)-3 'calculate the windows upper frame location
DAT$=" "+CHR$(30)+" "+CHR$(205)+" "+CHR$(31)+" "
MROW=ULR%+1
GOSUB POPLIST.DISP
MROW=LRR+1
GOSUB POPLIST.DISP
RETURN
'
'are we on the first screen of items
'
' IF BEGVAL > 1 THEN
' MROW=ULR%+1
' DAT$=" "+CHR$(30)+" "+CHR$(205)+" "+CHR$(31)+" "
' GOSUB POPLIST.DISP
' ENDIF
'
'are we neither at the top nor bottom of the list of items being displayed
'
' IF ENDVAL < MAXITEMS% THEN
' MROW=LRR+1
' DAT$=" "+CHR$(30)+" "+CHR$(205)+" "+CHR$(31)+" "
' GOSUB POPLIST.DISP
' ENDIF
'
' IF SELECT.% = 1 THEN
' MROW=ULR%+1
' DAT$=CHR$(205)+CHR$(205)+" "+CHR$(31)+" "+CHR$(205)+CHR$(205)
' GOSUB POPLIST.DISP
' ENDIF
'
' IF SELECT.% = MAXITEMS% THEN
' MROW=LRR+1
' DAT$=CHR$(205)+CHR$(205)+" "+CHR$(30)+" "+CHR$(205)+CHR$(205)
' GOSUB POPLIST.DISP
' ENDIF
'
POPLIST.DISP:
ATTR=(BACK% AND 7)*16+FORE%
CALL FASTPRT(DAT$,MROW,MCOL,ATTR)
RETURN
'
'
' Scan the list of items item looking for an item whose fitst character
'matches the keyboard character the user just typed.
'
POPLIST.FIND.OPTION:
SAVE.SELECT=SELECT.% 'save the current item highlighted
TEMP.SELECT=SELECT.%
FIRST.CHAR$=KP$ 'this is the character to look for
COUNT=0 'how many items have looked at
POPLIST.FIND.LOOP:
TEMP.SELECT=TEMP.SELECT+1 'look at the item after the current one
IF TEMP.SELECT>MAXITEMS% THEN 'are we at the end of the list
TEMP.SELECT=1 'Yes start back at the first item in the list
ENDIF
COUNT=COUNT+1 'we have looked at this many items so far
IF COUNT>MAXITEMS% THEN 'have we looked at all the items in the list
RETURN 'YES
ENDIF
MID$(TEMP.ITEM$,1)=ITEM$((TEMP.SELECT-SELECT.BASE)+ITEM.MIN)
LEN.TEMP.ITEM=LEN(ITEM$((TEMP.SELECT-SELECT.BASE)+ITEM.MIN))
'
'scan over leading spaces for this item, up to first character
'
FOR I=1 TO LEN.TEMP.ITEM
IF MID$(TEMP.ITEM$,I,1)<>" " THEN
IF MID$(TEMP.ITEM$,I,1)=FIRST.CHAR$ THEN
GOTO POPLIST.FOUND.IT 'this one was a match
ELSE
GOTO POPLIST.FIND.LOOP 'not this one, keep looking
ENDIF
ENDIF
NEXT
GOTO POPLIST.FIND.LOOP 'not this one, keep looking
'
POPLIST.FOUND.IT:
SELECT.%=TEMP.SELECT 'this is the item to select now
OLD=SELECT.%
BEGVAL=SELECT.% 'start the display window with this item
ENDVAL=(BEGVAL+SHOWITEMS%)-1 'and end with this item
IF ENDVAL > MAXITEMS% THEN 'are there enought items to fill this window
ENDVAL=MAXITEMS% 'NO, so display the last group of items
BEGVAL=(ENDVAL-SHOWITEMS%)+1 'and highlight the one found
ENDIF
GOSUB POPLIST.FILL 'display the group of items and highlight one found
RETURN
'
'
' Look for a keyboard key press or a mouse action and return a 'keystroke'
'
POPLIST.GET.PRESS:
IF BUTTONS%=0 THEN 'is a mouse supported?
GOTO POPLIST.GET.INKEY 'no, just look at the keyboard
ENDIF
CALL MMGETLOC(MOUSECOL,MOUSEROW) 'get the current mouse cursor scrren location
MOUSEROW=(MOUSEROW\8)+1 'convert row to 80x25 co-ordinates
MOUSECOL=(MOUSECOL\8)+1 'convert columnto 80x25 co-ordinates
'
' Check if the mouse is still in the window box
'
POPLIST.CHECK.IF.INBOX:
'
' Is the mouse outside the window frame
'
IF (MOUSEROW<MENU.TOP.ROW) OR (MOUSEROW>MENU.BOTTOM.ROW) THEN
GOTO POPLIST.OUTSIDE.BOX
ENDIF
'
' Is the mouse in the box or on the window frame
'
IF (MOUSECOL>=MENU.TOP.LEFT.COL) AND (MOUSECOL<=MENU.BOTTOM.RIGHT.COL) THEN
GOTO POPLIST.FOUNDIT
ENDIF
'
' Mouse cursor is outside the window, did user click any buttons
'
POPLIST.OUTSIDE.BOX:
CALL MMCLICK(LFT%,RGT%) 'see if left or right button clicked?
CLICK=LFT%+RGT%
IF CLICK=0 THEN 'any button clicked?
GOTO POPLIST.OUTSIDE.BOX.CONT 'NO
ENDIF
'
'If any button clicked outside window then simualte an ESC key press
'
IF (MOUSECOL<MENU.TOP.LEFT.COL-1) OR (MOUSECOL>MENU.BOTTOM.RIGHT.COL+1) THEN
KP$=CHR$(27) 'simulate ESC key press
RETURN
ENDIF
'
' Mouse was clicked on the top or bottom window frame, get the character under
'the mouse cursor (on the screen)
'
SCREEN.CHR=SCREEN(MOUSEROW,MOUSECOL)
KP$=CHR$(0)+CHR$(73) 'assume 'page up' to be simulated
IF MOUSEROW=MENU.TOP.ROW-1 THEN 'mouse on upper window frame?
IF SHOWITEMS%<>MAXITEMS% THEN 'are we doing POPMENU
IF SCREEN.CHR=31 THEN 'NO, user click on 'down' arrow
KP$=CHR$(0)+CHR$(81) 'YES, simulate 'page down' keystroke
RETURN
ELSEIF SCREEN.CHR=30 THEN 'was mouse cursor on 'up' character
RETURN
ELSE
RETURN
ENDIF
ENDIF
ENDIF
KP$=CHR$(0)+CHR$(81) 'assume 'page down' to be simulated
IF MOUSEROW=MENU.BOTTOM.ROW+1 THEN 'mouse on bottom window frame?
IF SHOWITEMS%<>MAXITEMS% THEN 'are we doing POPMENU
IF SCREEN.CHR=30 THEN 'NO, user click on 'up' arrow
KP$=CHR$(0)+CHR$(73) 'YES, simulate 'page up' keystroke
RETURN
ELSEIF SCREEN.CHR=31 THEN 'was mouse on 'down' character
RETURN
ELSE
RETURN
ENDIF
ENDIF
ENDIF
KP$=CHR$(27) 'Simualate an ESC keypress
RETURN
POPLIST.OUTSIDE.BOX.CONT:
GOSUB POPLIST.MMCURSORON 'turn the mouse cursor on
GOTO POPLIST.GET.INKEY 'see if a keyboard key pressed
'
POPLIST.FOUNDIT:
SELECT.%=BEGVAL+(MOUSEROW-MENU.TOP.ROW) 'this is the one we want to highlight now
IF SELECT.%<>OLD THEN 'are we on the same one as is currently highlighted
GOSUB POPLIST.FILL 'NO, so highlight the newone just selected with the mouse
OLD=SELECT.%
GOSUB POPLIST.MMCURSOROFF 'turn off the mouse cursor
CALL MMCLICK(LFT%,RGT%) 'clear any mouse clicks
GOTO POPLIST.GET.INKEY
ENDIF
GOSUB POPLIST.MMCURSOROFF 'turn off the mouse cursor
CALL MMCLICK(LFT%,RGT%) 'see if mouse clicked on the current highlighted item
CLICK=LFT%+RGT% 'was right or left button clicked?
IF CLICK THEN 'a button clicked?
KP$=CHR$(13) 'YES, simulate a ENTER key press
RETURN
ENDIF
POPLIST.GET.INKEY:
KP$=INKEY$ 'get a keyboard keypress character, if one avail.
IF LEN(KP$)=0 THEN 'keep looking for a mouse or keyboard action
GOTO POPLIST.GET.PRESS
ENDIF
RETURN
'
'
' The Window upper left frame co-ordinates were defined
'
POPLIST.GETORD:
QUADRANT$=LTRIM$(QUADRANT$) 'strip off any leading and trailing spaces
QUADRANT$=RTRIM$(QUADRANT$)
COLON.LOC=INSTR(QUADRANT$,":") 'find where the row/column separator char is loacted
IF COLON.LOC=1 THEN 'was a row defined
QUADRANT$="02"+QUADRANT$ 'NO, so default to row 02
COLON.LOC=3
ENDIF
ULR%=VAL(LEFT$(QUADRANT$,COLON.LOC-1)) 'convert row to a interger. to work with
IF (ULR%<1) OR (ULR%>24) THEN 'is row in valid range of screen co-ordinates
ULR%=2 'no, so default to row 02
ENDIF
IF COLON.LOC=LEN(QUADRANT$) THEN 'was a column co-ordinate defined
QUADRANT$=QUADRANT$+"00" 'NO, so default to 00
ENDIF
ULC%=VAL(MID$(QUADRANT$,COLON.LOC+1)) 'convert column to interger, to work with
IF (ULC%<1) OR (ULC%>80) THEN 'is the column in a valid range
GOSUB POPLIST.CENTER.ON.THE.LINE 'NO, so center the window on the row
ENDIF
QUADRANT.ROW$=STR$(ULR%) 'return the string of the row and column we are working with
QUADRANT$="0"+RIGHT$(QUADRANT.ROW$,LEN(QUADRANT.ROW$)-1)+":"
QUADRANT.COL$=STR$(ULC%)
QUADRANT$=QUADRANT$+"0"+RIGHT$(QUADRANT.COL$,LEN(QUADRANT.COL$)-1)
ULR%=ULR%+1 'allow for window header frame description
LRR=ULR%+SHOWITEMS%+1 'calculate the windows lower right row and column co-ord.
LRC=ULC%+WINDLEN-1
RETURN
POPLIST.CENTER.ON.THE.LINE:
TEMP.ULC%=40-(LENGTH.MENU.ITEM/2) 'calculate the center point on the row
IF (ULC%<2) THEN 'would window be outside screen?
TEMP.ULC%=2 'put it back in scrren and allow for frame (but not shadow)
ENDIF
ULC%=TEMP.ULC% 'this is the upper left column needed to center this window
RETURN
'
'
' Center the window frame header, within the window.
'
POPLIST.PUTHDR:
PAD=(WINDLEN/2)-(LEN(HEADER$)/2)-.5
MID$(TEMPHDR$,PAD+1,LEN(HEADER$))=HEADER$
HEADER$=TEMPHDR$
RETURN
'
POPLIST.MMCURSORON:
IF BUTTONS%=0 THEN 'is a mouse supported?
RETURN 'NO
ENDIF
IF MOUSE.CURSOR=0 THEN 'is the mouse off at present?
CALL MMCURSORON 'YES, turn it on
MOUSE.CURSOR=-1
ENDIF
RETURN
POPLIST.MMCURSOROFF:
IF BUTTONS%=0 THEN 'is a mouse supported?
RETURN 'NO
ENDIF
IF MOUSE.CURSOR=-1 THEN 'is the mouse on at present?
CALL MMCURSOROFF 'YES, turn it off
MOUSE.CURSOR=0
ENDIF
RETURN
'
POPLIST.SOUNDOFF:
SOUND 1000,1
SOUND 1500,2
SOUND 500,1
RETURN
'
POPLIST.DONE:
GOSUB POPLIST.MMCURSOROFF 'turn the mouse off as we leave
TEMP.ITEM$="" 'free string space
HEADER$=""
TEMPHDR$=""
DAT$=""
EXIT SUB 'return to caller
END SUB