create input field on screen without input command
Blitz3D Forums/Blitz3D Programming/create input field on screen without input command
| ||
| like input web form field in function |
| ||
| I'm typing this on my phone so cannot provide a link but look in code archives for a snippet called "rinput". It does what you need, with a little modification. |
| ||
you have to separate key-checking from displaying:
Graphics 800,600
Global Word$, Final$
Const KEY_BACKSPACE=8 , KEY_RETURN=13
Repeat
Cls
Color 255,110,255
x = (x+1) Mod 800
Text 10, 30,"press some KEYS and finsih with RETURN"
Text x, 300,Final
KeyCheck()
DisplayBox()
Flip
Forever
Function KeyCheck()
Key=GetKey()
If Key>0 And Key<32
; now check all keys you want to allow to manipulate strings:
DebugLog "special Key pressed= " + Key
Select Key
Case KEY_BACKSPACE
Word = Left(Word,Len(Word)-1)
;Case KEY_CURSOR
;....
;Case KEY_.....
Case KEY_RETURN
Final= Word
Word=""
End Select
ElseIf Key>31
; all others become part of the string
Word = Word + Chr(Key)
EndIf
End Function
Function DisplayBox()
If Word<>""
Color 255,255,0
Rect 100,100,300,40
Color 1,1,1
Text 110,110,Word
EndIf
End Function
this sample is very basic and you have to complete it for your needs |
| ||
| no i seek for that is in code 1190 in input section of code archive. I post a modification... look ; ID: 1190 ; Author: Eikon ; Date: 2004-11-10 23:02:25 ; Title: Custom Input boxes ; Description: bare bones GUI example |