In the following skeletal code, on the next keypress the previously pressed key is returned at least a couple of times. Releasing the aPRESS = "" line still gives a similar sort of result although returning whatever is set in aPRESS.
What am I doing wrong?
Code: Select all
InitSprite()
InitKeyboard()
Enumeration
#Window_0
EndEnumeration
Global aPRESS.s{1} ;Key pressed???
Global FontID1 : FontID1 = LoadFont(1, "Arial", 16)
OpenWindow(#Window_0, 0, 0, 500, 90, "Keyboard trap testing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ;---
OpenWindowedScreen(WindowID(#Window_0), 0, 0, 500, 300)
Repeat
Event = WaitWindowEvent()
;aPRESS = "-" ;Is this needed??
ExamineKeyboard() ;----- TEST KEYS
If KeyboardReleased(#PB_Key_V) ;Red
aPRESS = "V"
EndIf
If KeyboardReleased(#PB_Key_B) ;Green
aPRESS = "B"
EndIf
If KeyboardReleased(#PB_Key_X) ;Exit (Protem)
aPRESS = "X"
Event = #PB_Event_CloseWindow
End
EndIf
Debug aPRESS
Until Event = #PB_Event_CloseWindow
End