02-08-2023, 08:34 PM
(02-08-2023, 07:28 PM)bplus Wrote: Hi @Ron welcome to the forum!
This works for me on my Windows 10 laptop:
Code: (Select All)_Title "Test F4 key to exit" 'b+ 2023-02-08 mod wiki On Key(n) example
Key(4) On ' F1 too important use F4 to quit
On Key(4) GoSub quit
Print "Press F4 to quit!"
temp = _Exit
Do
Cls
count = count + 1
Print count
_Limit 30 ' <<< really needed to slow down looping
Loop 'never ending loop
End ' just in case no fall through to gosub
quit: ' set to quit when press F4
End
Return
Never used On Key before, looks like you need additional Key(n) On as part of setup. And probably used to deactivate too, ie Key(n) Off
I tested on QB64pe 3.4.1 but see no reason why an earlier version would not work. I did have to slow the looping down with _Limit to catch the Key.
PS oh looky keys for the arrows!
Thank You bplus did not know you had to turn the key on first will test it out.