INPUT command doesn't wait for key release

This forum is dedicated to those who want support programming in ugBASIC.
Questo forum è dedicato a chi desidera supporto per programmare in ugBASIC.
Ce forum est dédié à ceux qui souhaitent prendre en charge la programmation en ugBASIC.
Post Reply
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

INPUT command doesn't wait for key release

Post by jjarrell »

When using INPUT$ or INPUT commands using the COCO3 compiler, as soon as you press a key it fills up the line of text. Like it doesn't wait for a key release so you can type the next character.

For the example below, you press a key and then the program ends showing you entered the same key 10 times.

Would you use the DEFINE INPUT/KEYBOARD DELAY command? If so, what is a good example of how to use it?

Code: Select all

   
   CLS
   CLEAR KEY
   PRINT "PLEASE TYPE IN TEN CHARACTERS"
   PRINT
   v=INPUT$(10)
   PRINT "YOU TYPED: ";v
 
spotlessmind1975
Site Admin
Posts: 204
Joined: Fri Oct 06, 2023 8:25 pm

Re: INPUT command doesn't wait for key release

Post by spotlessmind1975 »

Hi jjarrell , and welcome! :D
jjarrell wrote: Tue Jan 28, 2025 6:57 pm For the example below, you press a key and then the program ends showing you entered the same key 10 times.
First of all, I apologize for the issue you encountered. The bug has been fixed for the commands you reported, and the fix is ​​already up on the repository and available as COLDFIX (sandbox will be updated within an hour or so). Please, update to COLDFIX v1.17 [rev. 20250128] using UGBASIC-IDE or, if you are using the command line, download it directly by accessing this link:
https://ugbasic.iwashere.eu/install
jjarrell wrote: Tue Jan 28, 2025 6:57 pm For the example below, you press a key and then the program ends showing you entered the same key 10 times.
Thank you for the example: it works correctly using the latest COLDFIX.
jjarrell wrote: Tue Jan 28, 2025 6:57 pm Would you use the DEFINE INPUT/KEYBOARD DELAY command? If so, what is a good example of how to use it?
Actually, those parameters are useful and supported only if you are using asynchronous mode for keyboard access. In case of synchronous mode, instead, the parameters may or may not be respected, depending on the target in use. Note that asynchronous mode, while it may be effective in some respects, may be less efficient than synchronous mode on some targets (like coco3). On this page you can find a brief introduction, but I suggest you refer to the user manual, where these aspects are better described.

To activate asynchronous mode you need to use the directive:

Code: Select all

DEFINE KEYBOARD ASYNC
Hope this helps!
jjarrell
Posts: 36
Joined: Tue Jan 28, 2025 5:35 pm

Re: INPUT command doesn't wait for key release

Post by jjarrell »

Works great! I tried it in both the sandbox and ide.
Post Reply