I was wondering if someone has a good snipped to capture keyboard, including repetition, Delete, multiple keypressed, Shift etc...
This is a snipped of the code i use. As you can see it's not very smooth for typing. (test shifted symbol for exemple and repetitions...)
Code: Select all
Xres=1024:yRes=600
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0:MessageRequester("Error", "Can't open the sprite system", 0):End:EndIf
If OpenWindow(0, 0, 0,Xres, Yres, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)=0:MessageRequester("Error", "Can't open windowed screen!", 0):EndIf
If OpenWindowedScreen(WindowID(0), 0, 0, xres, yres, 0, 0, 0)=0:MessageRequester("Error", "Can't open windowed screen!", 0):EndIf
Repeat
FlipBuffers()
ClearScreen(#Black)
Repeat:Event = WindowEvent():Until Event = 0
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Back)
text$ = Left(text$, Len(text$)-1)
ElseIf KeyboardPushed(#PB_Key_PadEnter)
text$+Chr(13)
Else
resultat$=KeyboardInkey()
If FindString("1234567890 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzéêïèçàù.,!?;:§%*µ+$£^¨=)°@_`|-(\{#~&²<>"+Chr(13), resultat$)
text$ + resultat$
EndIf
EndIf
StartDrawing(ScreenOutput())
DrawText(0,0,"Type your text... [Escape] To quit")
DrawText(0,40,text$)
StopDrawing()
Until KeyboardPushed(#PB_Key_Escape)