To help you though (after reading the above post) ;) here is an example single-line text box. It utilises all the "legal" character inputs, both enter keys, and backspaces, and will work with any sized font.
+BlackD
Graphics 800,600 font=LoadFont("arial",17) SetFont font SetBuffer BackBuffer() Inputx = 14 ;Spot to start drawing text - for calculation inputtxt$="" ;The empty string we're using exitloop=0 While exitloop=0 ;use this rather than keyhit(28) as you ;also need To detect KeyHit(156) for ;numpad ENTER Cls Color 155,155,255 Text 5,10,">" Color 200,200,200 Text 14,10,inputtxt$ Rect inputx,12,8,13 a=GetKey() If a > 31 And a < 126 And a <> 96 And inputx < 780 Then ;make sure it's a legal character, ;and that it's within the screen limit inputtxt$=inputtxt$+(Chr$(a)) inputx=inputx+StringWidth(Chr$(a)) End If If KeyHit(28) Or KeyHit(156) Then exitloop = 1 ;check for ENTER If KeyDown(14) Then ;do backspace stuff :) If inputx > 14 Then lastchar$=Right$(Inputtxt$,1) inputtxt$=Left$(inputtxt$,(Len(inputtxt$)-1)) inputx=inputx-StringWidth(lastchar$) If KeyDown(14) Then Delay 80 ;checks if backspace is still being held, to delay ;deleting the next character a bit - obviously if ;you're using animation etc elsewhere, you don't ;want a delay statement so would need to do this ;another way End If End If Flip Wend Cls Color 255,255,255 Text 0,0,"You typed : "+inputtxt$ Flip WaitKey() End
+BlackD