;** Eingaberoutine - ersetzt Input
;** 2003 by Triton
;** www.silizium-net.de
Graphics 640,480,16,2
SetBuffer BackBuffer()
Global antwort$,backtime = MilliSecs(),ccolor
While Not KeyDown(1)
befehl$ = newinput$(100,100,300,200,">>", 10)
If Len(befehl$) > 0 Then
Print befehl$
WaitKey
End
End If
Flip
Cls
Wend
;---
Function newinput$(x1,y1,x2,y2,frage$,maxl)
a = GetKey()
If a => 32 And a <= 255 And Len(antwort$) <= maxl-1 Then antwort$ = antwort$ + Chr$(a)
If KeyDown(28) Then Return antwort$
If KeyDown(14) Or KeyDown(203) And Len(antwort$) > 0 And MilliSecs()-backtime > 125 Then
antwort$ = Left(antwort$,(Len(antwort$)-1))
backtime = MilliSecs()
End If
Color 25,100,200
Rect x1, y1,x2-x1, y2-y1,1
Color 10,50,150
Rect x1, y1,x2-x1, y2-y1,0
textlange = StringWidth(antwort$) ;Blinkener Cursor
texthohe = StringHeight(antwort$)
fragelange = StringWidth(frage$)
Color 0,50,ccolor
Rect x1+((Len(frage$)+Len(antwort$))*8)+12,y1+4,10,texthohe-1,1
ccolor = ccolor + 5
If ccolor = 255 Then ccolor = 100
Color 255,255,255
Text x1+3,y1+3, frage$ + " " + antwort$
End Function
|