Página 1 de 1

Problem when holding key

Publicado: Mar Oct 23, 2012 9:03 pm
por emeasoft
Hello Xailers!
Im having a problem when Im holding a key and the program is processing... after the processing, the keys inputs accumulated are all released causing the program to process it all over again and sometimes it crashes... It seems that all the key inputs are being accumulated on the buffer! Is there anything I can do to avoid this problem?
In the example, hold enter for about 3 seconds and see the debug window.
TIA,
Juliano

Attached files HOLD KEY.zip (2.5 KB)Â

Problem when holding key

Publicado: Mié Oct 24, 2012 10:33 am
por ignacio
emeasoft escribió el mar, 23 octubre 2012 21:03Hello Xailers!
Im having a problem when Im holding a key and the program is processing... after the processing, the keys inputs accumulated are all released causing the program to process it all over again and sometimes it crashes... It seems that all the key inputs are being accumulated on the buffer! Is there anything I can do to avoid this problem?
In the example, hold enter for about 3 seconds and see the debug window.
TIA,
Juliano
That's right, is how Windows works. Any user operation provokes
a lot of Windows messages that must be processed. In idle states the messages are processed correctly since your program is just waiting for them. But if your program is performing a large loop process, those messages get not processed and they wait for it on Windows message queue.
The are two things you can do about this:
1) Call ProcessMessages() function in the loop
2) Disable all the controls and forms that can interfere with your loop
Be aware that when you call ProcessMessages() your program will accept messages, so for example,it is possible to close the windows in the middle of the loop.
Regards,

Problem when holding key

Publicado: Mié Oct 24, 2012 7:45 pm
por emeasoft
Thanks for the help Ignacio!
One more question, isn't there any way to clear this "buffer" that keep the messages?
Thanks,
Juliano

Problem when holding key

Publicado: Mié Oct 24, 2012 10:07 pm
por emeasoft
Quote:
CLEAR TYPEAHEAD
Description
The CLEAR TYPEAHEAD command clears the keyboard buffer by removing all pending key strokes from the internal buffer. Key strokes are collected in this buffer, for example, when the user holds a key pressed and the application needs more time for processing key strokes than recording them.

CLEAR TYPEAHEAD
Empties the keyboard buffer.
How to replace this in Xailer?
Mário Angelini

Problem when holding key

Publicado: Jue Oct 25, 2012 9:21 am
por jfgimenez
Mário,
> CLEAR TYPEAHEAD
> Empties the keyboard buffer.
It'll never work in Xailer, since it's only for console, not GUI programs.
> How to replace this in Xailer?
Try calling:
XA_NextKey( 1 )
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info

Problem when holding key

Publicado: Jue Oct 25, 2012 3:10 pm
por emeasoft
José:
Resolve sim.
Poderia colocar esta função na documentação de Xailer?
Abraços.