Reading the backspace key.

BlitzMax Forums/BlitzMax Beginners Area/Reading the backspace key.

CoderLaureate(Posted 2005) [#1]
Hello!

I have a question that one (or several) of you may be able to answer in a heartbeat.

I'm having trouble reading the "Backspace" key on my standard us keyboard. I've tried "KeyHit(KEY_BACKSPACE)", "if GetChar() = 8". Neither of them work. The key just gets ignored.

-Jim


Perturbatio(Posted 2005) [#2]
try using this code to find the scancode for it:

Graphics 640,480,0,0

While Not KeyDown(KEY_ESCAPE)
Cls
For Local a:Int = 1 To 256
	If KeyDown(a) Then DrawText(a, 10, 10)
Next
Flip
Wend
End



tonyg(Posted 2005) [#3]
I had the same problem...
here
Never got a response so not sure if it's *really* easy and nobody wanted to embarrass me.


CoderLaureate(Posted 2005) [#4]
Strangest thing. KeyDown works, but not KeyHit. Could this be a bug?


Perturbatio(Posted 2005) [#5]
can you post an example?

keyhit works for me:
Graphics 640,480,0,0
While Not KeyDown(KEY_ESCAPE)

If KeyHit(KEY_BACKSPACE) Then Print "bs"

Wend




CoderLaureate(Posted 2005) [#6]
Got it figured out! Thanks!


tonyg(Posted 2005) [#7]
Hold on, my code from months ago *WAS* rubbish...
Graphics 640,480
Local t$
While Not KeyHit( KEY_ESCAPE )
	Local c=GetChar()
	If c=8 t = Left$(t,(Len(t)-1))
    If c<>8 And c<>0 t:+Chr(c)
	Cls
 	DrawText t,0,0
	Flip
Wend