Key down not just pressed

lorebf

Member
Licensed User
Longtime User
I've been looking around and I just cannot find how to know when a key or button is down, and not just pressed.

I want to be able to hold the physical button down (while thrusting a spaceship), but the program doesn't know when the key is released..

I've tried the "Sub Activity_KeyDown (KeyCode As Int) As Boolean" but it does not know when a key is released. Only when a key is pressed.
If i hold a button, and press another it doesn't know that the first button is still down.
 

Smee

Well-Known Member
Licensed User
Longtime User
Has this feature been implemented yet? i also wish to continue an activity whilst the key has been pressed
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Yes. There are now two events KeyPressed and KeyUp.

Thanks for the quick reply Erel.

How would i program something like this

B4X:
Sub    ButtonPress_Down

do while ButtonDown=True

Code here

loop

end sub
 
Upvote 0
Top