BBS: Inland Empire Archive Date: 02-05-93 (04:23) Number: 392 From: ROB MCKEE Refer#: NONE To: ERIC MAYS Recvd: NO Subj: Re: HELP PLEASE!!!! 2 of Conf: (2) Quik_Bas
Hello Eric!
You wrote in a message to Geoffrey Liu:
EM> How can I repplace all theinput and line input statements...
EM> Tell me the way to do it because I'm stuck making a security
EM> menu system that anyone can ctrl -c out of...
----------- 8< -----------
'Another Quik_Bas Kludge-O-Matic
' Multi Function Sub..
' If St= 1 then Display Original String$ and_
start at position 1 if any
' editing key is hit then the original is used_
otherwise the string is
' blanked and you start working on another
' Pre$ = What ever you want the Default Return string
' to be.
' Good$= THe Allowable Charcters in the return string
' Play with it and you'll figure it out..
DEFINT A - Z
SUB plinput (RetStr$, Pre$, Good$, MaxLength%, St%)
r = CSRLIN
c = POS(0)
PRINT space$(MaxLength%);
LOCATE r, c
PRINT "";
RetStr$ = RTRIM$(Pre$)
ins = True ' Where True = -1
IF St = 1 THEN
CsrPtr = 1
'
ELSEIF St = 0 THEN
CsrPtr = LEN(RetStr$) + 1
ELSE
CsrPtr = LEN(RetStr$) + 1
KeyIn% = True
END IF
DO
LOCATE r, c
PRINT LEFT$(RetStr$ + SPACE$(MaxLength%), MaxLength%);
LOCATE r, c + CsrPtr - 1, 1
IF ins THEN LOCATE , , 1, 6, 7 ELSE LOCATE , , 1, 1, 7
PRINT "";
DO: i$ = INKEY$: LOOP WHILE i$ = ""
KeyCode%= CVI(i$+CHR$(0))
IF (KeyCode% = 8) AND ((CsrPtr > 1) and (_
LEN(RetStr$) >0)) THEN
RetStr$ = LEFT$(RetStr$, CsrPtr - 2) +_
MID$(RetStr$, CsrPtr):
CsrPtr = CsrPtr - 1
ELSEIF (INSTR(Good$, i$) > 0) AND KeyIn% = False THEN
RetStr$ = i$
CsrPtr = 2
ELSEIF (INSTR(Good$, i$) > 0) AND_
(MaxLength% > LEN(RetStr$)) THEN
IF ins THEN InsPtr = CsrPtr else InsPtr = CsrPtr +1
IF CsrPtr > 0 THEN
RetStr$ = LEFT$(RetStr$, InsPtr - 1) +_
i$ + MID$(RetStr$, InsPtr)
End IF
CsrPtr = CsrPtr + 1
ELSEIF KeyCode% = 13 THEN
EXIT SUB
ELSEIF KeyCode% = 19712 THEN 'Right
IF CsrPtr <= MaxLength% THEN CsrPtr = CsrPtr + 1
ELSEIF KeyCode%= 19200 THEN 'Left
IF CsrPtr > 1 THEN CsrPtr = CsrPtr - 1
ELSEIF KeyCode%= 20224 THEN ' End
CsrPtr = LEN(RetStr$) + 1
ELSEIF KeyCode%= 18176 THEN ' Home
CsrPtr = 1
ELSEIF KeyCode%= 30464 THEN ' Cntrol -home
IF LEN(RetStr$) THEN
RetStr$ = MID$(RetStr$, CsrPtr)
CsrPtr = 1
END IF
ELSEIF (KeyCode%= 29952) and (_
LEN(RetStr$)>0) THEN ' Cntrol End
RetStr$ = LEFT$(RetStr$, CsrPtr - 1)
CsrPtr = LEN(RetStr$) + 1
ELSEIF KeyCode%= 29696 THEN ' Cntrol Right
IF CsrPtr <> LEN(RetStr$) + 1 THEN
CsrPtr = INSTR(CsrPtr + 1, RetStr$ + " ", " ")
END IF
ELSEIF KeyCode%= 29440 THEN ' Cntrol Left
FOR g = CsrPtr - 2 TO 2 STEP -1
IF MID$(RetStr$, g, 1) = " " THEN EXIT FOR
NEXT g
IF g > 0 THEN
IF MID$(RetStr$, g, 1) = " " THEN
CsrPtr = g + 1
ELSE
CsrPtr = 1
END IF
END IF
ELSEIF KeyCode% = 127 THEN ' 1 Cntrol -BS
RetStr$ = "": CsrPtr = 1
ELSEIF KeyCode% = 20992 THEN ' Ins
IF ins THEN ins = False ELSE ins = True
ELSEIF KeyCode% = 21248 THEN ' Del
IF MID$(RetStr$, CsrPtr) <> "" THEN
RetStr$ = LEFT$(RetStr$, CsrPtr - 1) +_
MID$(RetStr$, CsrPtr + 1)
END IF
END IF
KeyIn% = True
LOOP
END SUB
------------ 1 of 2 functions and 2 messages --------
EM> Thanks A Million!!!
Na... you need to send me 10% ;)
Catcha Later , I'll see you on the flip side - Rob
--- timEd/B6
* Origin: Another Quik_Bas Point in Richmond, CA (1:125/1212.13)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET