Subject Re: [IBO] Capturing keystrokes
Author Geoff Worboys
> Any ideas how to flush the unnecessary keystrokes?

There are ways of flushing the keyboard buffer (or there were under
DOS, I've never tried to access them within Windows). However I
suggest your best bet is to track whether a key that has been
processed has been released.

As Bill suggested, the simplest way is by using the OnKeyUp event.
However if you really want to event to occur while the key is down,
then you probably need something like like the following pseudo

TForm1 = class( TForm )
FCurKey: ShortCut;
FFlag: integer;

if Key is one I want to track (alpha without ctrl or alt) then
tmpShortCut := ShortCut(Key,Shift);
if FFlag = 0 then
FCurKey = tmpShortCut;
if FCurKey = tmpShortCut then

if FFlag = 1 then // only process on first instance of keypress
accept the key

tmpShortCut = Shortcut(Key,Shift);
if tmpShortCut = FCurKey then
FFlag := 0;

I've done something similar to this in another application (somewhere
on my disk :-). I hope the above is enough to indicate what I mean.

Geoff Worboys
Telesis Computing