OEInput "{F-.2}Enter a float (Unlimited.2)=>", a$
OEInput "{F0.2}Enter a float (0.2) =>", a$
OEInput "{F9.2}Enter a float (9.2) =>", a$
OEInput "{F9.-}Enter a float (9.unlimited) =>", a$
OEInput "{P}Enter a password =>", a$
OEInput "{UI}Enter an unsigned integer =>", a$
OEInput "{I}Enter an integer=>", a$
OEInput "{IL10}Enter an integer of less than 10 digits =>", a$
OEInput "{X15,Y15}Enter whatever at loc 15,15 =>", a$
OEInput "{D}Check to make certain paste is disabled here =>", a$
OEInput "Enter whatever here, but use paste. See if the cursor remains BEFORE the paste. => ", a$
OEInput "{V}Enter whatever here, but use paste. See if the cursor moves AFTER the paste. => ", a$
PRINT "Press <ANY KEY> to clear the screen -- we're getting full!"
OEInput "{H}This should hide itself, after you enter whatever =>", a$
PRINT "Is the question and input gone? This line should be at the top left corner of your screen." PRINT "And here's your input => "; a$
SUB OEInput
(prompt$
, result$
) 'Over Engineered Input 'limit VALUES:
'1 = Unsigned
'2 = Integer
'4 = Float
'8 = Who cares. It's handled via internal variables and we don't need to know a type for it.
OX = X: OY = Y 'original x and y positions
CP = 0: OldCP = 0 'Cursor Position
length_limit = -1 'unlimited length input, by default
IF i
THEN 'yep, we have something! IF INSTR(limiter$
, "I") THEN 'can't limit to BOTH an integer AND a float limit
= limit
OR 2 'Integer limit
= limit
OR 4 'Float float_before_limit = GetValue(limiter$, "F")
float_after_limit
= GetValue
(MID$(limiter$
, INSTR(limiter$
, "F") + 1), ".") IF INSTR(limiter$
, "P") THEN password_protected
= -1: limit
= limit
OR 8 'don't show passwords. length_limit = GetValue(limiter$, "L")
X = GetValue(limiter$, "X")
Y = GetValue(limiter$, "Y")
IF INSTR(limiter$
, "D") THEN disable_paste
= -1: limit
= limit
OR 8 'disable paste IF INSTR(limiter$
, "V") THEN cursor_after_paste
= -1: limit
= limit
OR 8 'disable paste IF INSTR(limiter$
, "H") THEN clean_exit
= -1: limit
= limit
OR 8 'disable paste
SELECT CASE k
'ignore all keypresses except ALT-number presses CASE -57 TO -48: AltWasDown
= -1: alt$
= alt$
+ CHR$(-k
) SELECT CASE k
'without alt, add any keypresses to our input oldin$ = in$
IF CP
> 0 THEN OldCP
= CP: CP
= CP
- 1 in$
= LEFT$(in$
, CP
) + MID$(in$
, CP
+ 2) 'backspace to erase input oldin$ = in$
in$
= LEFT$(in$
, CP
) + SPACE$(4) + MID$(in$
, CP
+ 1) 'four spaces for any TAB entered OldCP = CP
CP = CP + 4
oldin$ = in$
in$
= LEFT$(in$
, CP
) + temp$
+ MID$(in$
, CP
+ 1) 'ctrl-v paste 'CTRL-V leaves cursor in position before the paste, without moving it after.
'Feel free to modify that behavior here, if you want it to move to after the paste.
IF cursor_after_paste
THEN CP
= CP
+ LEN(temp$
) check_input:
oldin$ = in$
IF k
= 45 AND CP
= 0 THEN GOTO good_input
'only allow a - sign for the first digit IF k
= 45 AND CP
= 0 THEN GOTO good_input
'only allow a - sign for the first digit IF LEN(temp$
) < float_before_limit
OR float_before_limit
= -1 THEN in$
= LEFT$(in$
, CP
) + CHR$(k
) + MID$(in$
, CP
+ 1) 'add input to our string OldCP = CP
CP = CP + 1
IF LEN(temp$
) < float_after_limit
OR float_after_limit
= -1 THEN in$
= LEFT$(in$
, CP
) + CHR$(k
) + MID$(in$
, CP
+ 1) 'add input to our string OldCP = CP
CP = CP + 1
good_input:
IF CP
< length_limit
OR length_limit
< 0 THEN in$
= LEFT$(in$
, CP
) + CHR$(k
) + MID$(in$
, CP
+ 1) 'add input to our string
OldCP = CP
CP = CP + 1
CP = 0
oldin$ = in$
CP = CP - 1
CP = CP + 1
k = v
alt$ = "": AltWasDown = 0
blink
= (blink
+ 1) MOD 30
result$ = in$
jstart
= INSTR(limiter$
, what$
): j
= 0 GetValue = -1 'unlimited
j = j + 1
m$
= MID$(limiter$
, jstart
+ j
, 1) GetValue
= VAL(MID$(limiter$
, jstart
+ 1, j
- 1))