Input string

Blitz3D Forums/Blitz3D Beginners Area/Input string

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Second Chance:

Is this any help? It's very basic but should give you some ideas (first you'd want to 'add up' all the individual letters to get the total input string, hint: userinput$=userinput$+s$)

Next you'll need to process special characters - like backspace,enter,cursor keys etc etc.

Graphics 640,480,16,1

fnt=LoadFont("Arial",24) 


SetFont(fnt)



Cls
Text 0,0,"Enter a big string then hit return"

;start position of our input string
x=0
y=32

While Not KeyDown(28)

	letter=WaitKey()
	
	s$=Chr(letter)
	
	; get the width in pixels of the letter
	moveright=StringWidth (s$)
	
	;display it
	Text x,y,s$
	
	;move print position (X) right by the width ofthe character just printed
	x=x+moveright
	
	;reached edge? if so go to next line and start at left again
	If x>640 Then
		x=0
		y=y+24
	EndIf



Wend
WaitKey()
End