Posts: 277
Threads: 3
Joined: Apr 2022
Reputation:
52
How are you trying to use it? "Input" blocks execution of the program at that point until the Input statement is done. Meaning, for the _keydown to trigger you need to be holding ESC down before hitting Enter to end the Input statement. Otherwise it just loops once and blocks on Input again before you can ever press ESC.
Posts: 1,164
Threads: 111
Joined: Apr 2022
Reputation:
102
DO
INPUT "Number: ", n!
LOOP UNTIL _KEYDOWN(27)
The loop above can never be terminated because in order to leave the INPUT statement you must press ENTER.
DO
INPUT "Number: ", n!
LOOP UNTIL n! = 0
The loop above can terminate because it relies on the value of n!
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Posts: 944
Threads: 51
Joined: May 2022
Reputation:
31
Thanks for the answers!
DSMan195276, yes, that's right! It would be a good notice in the wiki for KeyDown
Terry, I know that one can end the loop in another way, but this about KeyDown was unknown me.
Posts: 2,571
Threads: 264
Joined: Apr 2022
Reputation:
140
09-16-2024, 07:53 PM
(This post was last modified: 09-16-2024, 07:55 PM by Pete.)
Oh just write a custom keyboard input routine you lazy varmint!
or...
Code: (Select All)
Do
Input a
Sleep 1
Loop Until _KeyDown(27)
Now you don't need no stinkin' null value... but ya gotta be quick!
Pete
Shoot first and shoot people who ask questions, later.
Posts: 2,571
Threads: 264
Joined: Apr 2022
Reputation:
140
09-16-2024, 09:41 PM
(This post was last modified: 09-16-2024, 09:42 PM by Pete.)
10 seconds to make up your mind? No wonder the Germans lost WWII!
Now if you will excuse me, Steve's on his way over to take my award photo!
Pete
Shoot first and shoot people who ask questions, later.