How to check keyboard state as in IsPressed(Key.Esc)
Posted
#1
(In Topic #1546)
Regular

Posted
Posted
Regular

cogier said
Have a look HERE
I am looking for a way that is not tied to a Click() or KeyPress() event.
Is there a way to simply read the state of keys or a single specific key anywhere from code?
Posted
Guru

JumpyVB said
cogier said
Have a look HERE
I am looking for a way that is not tied to a Click() or KeyPress() event.
Is there a way to simply read the state of keys or a single specific key anywhere from code?
No, Key.class properties (except for constants) are invalid outside of a KeyPress/KeyRelease event.
The trick would be to use Wait to allow the event loop to cycle and register key events (using Wait too much can slow the program down so maybe periodically)
something like this…
Code (gambas)
Posted
Regular

BruceSteers said
No, Key.class properties (except for constants) are invalid outside of a KeyPress/KeyRelease event.
My main form is being unresponsive as the processing is being done. So okay, I guess I will have to resort to Button.Cancel as suggested by cogier. Only, first I need to turn my main processing loop to an asynchronous background task. Which won't be an easy ordeal.
Posted
Guru

JumpyVB said
BruceSteers said
No, Key.class properties (except for constants) are invalid outside of a KeyPress/KeyRelease event.
My main form is being unresponsive as the processing is being done. So okay, I guess I will have to resort to Button.Cancel as suggested by cogier. Only, first I need to turn my main processing loop to an asynchronous background task. Which won't be an easy ordeal.
Hence the use of Wait.
No response to key events will also be no response to button clicks if the event loop cannot cycle.
1 guest and 0 members have just viewed this.


