home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
!MAGS
/
!BONUS
/
COVERDSK
/
STFORMAT
/
STF40.ZIP
/
STF40A.MSA
/
AUTOZEST
/
ENTRY.LST
< prev
next >
Wrap
File List
|
2004-11-04
|
4KB
|
79 lines
PROCEDURE text_entry_box(max_length%,upper_y%)
' Here's a quick and simple text entry box for use with the ZeST interface.
' Simply pass the maximum length (max_length%) of the text string (string$)
' and the upper_y% coordinate for the top of the text entry box.
' The display will be automatically centered for you.
' --------------------------------------------------------------------------
' max_length% for text input cannot exceed 74 characters or be less than 0
IF max_length%>74 OR max_length%<0 THEN
max_length%=74
ENDIF
' upper_y% for top of text entry box cannot be more than 350 or less then 0
IF upper_y%<0 OR upper_y%>350 THEN
upper_y%=350
ENDIF
' --------------------------------------------------------------------------
' calculate the box width in relation to the maximum text string length
l_side%=INT(639-(max_length%*8))/2
r_side%=639-l_side%
' --------------------------------------------------------------------------
' store the screen section where the text entry box will be drawn
GET l_side%-27,upper_y%-2,r_side%+27,upper_y%+52,putback$
' --------------------------------------------------------------------------
' draw a platform and place a text box inside based on the calculations
GOSUB zest_button(l_side%-25,upper_y%,r_side%+25,upper_y%+50)
GOSUB zest_text_box(l_side%-15,upper_y%+10,r_side%+15,upper_y%+40)
' --------------------------------------------------------------------------
' calculate the correct postion of the string within the text window
x_pos%=l_side%
y_pos%=upper_y%+31
' --------------------------------------------------------------------------
' make sure the input string starts out empty and display the cursor
string$=""
TEXT x_pos%,y_pos%,CHR$(95)
' --------------------------------------------------------------------------
DO
' continuously test for a keypress (don't forget upper and lower case!)
KEYTEST key
IF key<>0 THEN
SELECT key
CASE 1835021,7471117,275906573,270270477
' RETURN or ENTER key
' exit loop if the return key is pressed and string$ contains text
EXIT IF TRIM$(string$)<>""
CASE 6356992,274792448
' UNDO key
string$=""
' clear string$ and exit loop when undo key is pressed
EXIT IF TRIM$(string$)=""
CASE 4915200,273350656
' LEFT KEY
CASE 5046272,273481728
' RIGHT KEY
CASE 917512,269352968
' BACKSPACE key
' remove only the last character of string$
IF LEN(string$)>0 THEN
string$=LEFT$(string$,(LEN(string$)-1))
TEXT x_pos%,y_pos%,string$+CHR$(95)+SPACE$(max_length%-LEN(string$))
ENDIF
CASE 65563,268501019
' ESC key
' clear string$ when ESC is pressed
string$=""
TEXT x_pos%,y_pos%,string$+CHR$(95)+SPACE$(max_length%-LEN(string$))
DEFAULT
' if string length will not be exceeded then add the character pressed
IF LEN(string$)<max_length% THEN
string$=string$+CHR$(key)
' also calculate how many empty spaces to place after string$
TEXT x_pos%,y_pos%,string$+CHR$(95)+SPACE$(max_length%-LEN(string$))
ENDIF
ENDSELECT
ENDIF
LOOP
' --------------------------------------------------------------------------
' put back the original screen section after using the text entry box
PUT l_side%-27,upper_y%-2,putback$
RETURN