Graphics 800,600,0 While Not KeyHit(KEY_ESCAPE) Cls SetColor 255,0,0 DrawRect 10,10,90,90 SetColor 255,255,255 name$=InputText("What is your name? ",200,200) DrawText "Hello there, " + name$ + "!",220,220 Flip Delay 1000 Wend End Function InputText:String(prompt:String, x:Int, y:Int, wait:Int=True, clear:Int=True) Local vx:Int, vy:Int, vw:Int, vh:Int Local char:Int, pl:Int = TextWidth(prompt), ph:Int = TextHeight(" ") Global out:String GetViewport(vx, vy, vw, vh) If clear Then out = "" Repeat char = GetChar() Select True Case char = 8 If out.Length > 0 Then out = out[..out.Length - 1] Case char = 13 wait = False Case char > 31 out :+ Chr(char) End Select SetViewport x, y, pl + TextWidth(out$ + " "), ph Cls If (MilliSecs() Mod 750) < 375 DrawText prompt + out, x, y Else DrawText prompt + out + "_", x, y EndIf Flip Until wait = False SetViewport vx, vy, vw, vh Return out End Function