Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Text/Number Input Routines.

Author
Message
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 1st Jan 2003 23:57
Here's some text and numeric input functions to help with more controlled way of inputting data. You can take out the:
SET TEXT FONT "Courier New"
SET TEXT SIZE 15
As i've only put that in due to me using a fixed width font when doing text input.


FUNCTION InputString(X AS INTEGER,Y AS INTEGER,InputLength AS INTEGER, Prompt$ AS STRING, PreviousString$ AS STRING)
` This routine will be the main input routine, the InputNum function will convert the number to a string and input with this function.
`
` X,Y Will be the coordinates on screen
` Prompt is a prompt on screen if Required
` Previous String if needed
`
` Setup Font and Characteristics
`
SET TEXT FONT "Courier New"
SET TEXT SIZE 15
SET TEXT OPAQUE
`
` Setup Temporary Veriables
`
PromptWidth=TEXT WIDTH(Prompt$)
InputX=X+PromptWidth+2
Res$=PreviousString$
CurrentPos=LEN(Res$)
IF InputLength""
PRINT PreviousString$;
ENDIF
PRINT "_";
`
` Main Input Loop
`
DO
IF RETURNKEY()
WHILE RETURNKEY()
ENDWHILE
SET CURSOR InputX,Y
PRINT Res$;" ";
EXIT
ENDIF
Key$=ENTRY$()
IF Res$"" AND ASC(Key$)=8
Res$=LEFT$(Res$,LEN(Res$)-1)
Key$=""
SET CURSOR InputX,Y
PRINT Res$;"_ ";
ENDIF
IF Key$"" AND LEN(Res$)31
IF ASC(Key$)>=48 AND ASC(Key$)
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 1st Jan 2003 23:58
Hmmmmmm, Every time i submit code, the first code tages always get dropped trying again

Login to post a reply

Server time is: 2024-11-24 07:29:17
Your offset time is: 2024-11-24 07:29:17