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)Â
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Problem when holding key
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Problem when holding key
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,
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,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Problem when holding key
Thanks for the help Ignacio!
One more question, isn't there any way to clear this "buffer" that keep the messages?
Thanks,
Juliano
One more question, isn't there any way to clear this "buffer" that keep the messages?
Thanks,
Juliano
Problem when holding key
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
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
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
> 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
José:
Resolve sim.
Poderia colocar esta função na documentação de Xailer?
Abraços.
Resolve sim.
Poderia colocar esta função na documentação de Xailer?
Abraços.