Re: Keypress Event problem
- From: "alanglloyd@xxxxxxx" <alanglloyd@xxxxxxx>
- Date: Tue, 24 Feb 2009 00:37:43 -0800 (PST)
On 24 Feb, 01:41, "Paul E. Schoen" <pst...@xxxxxxxxx> wrote:
I have added an OnKeypress routine to my main form. It seems to work OK if<snip>
I press the key and wait for the subsequent process to complete, but it
causes an access error if I press the key twice or more in rapid
succession. The procedure performs some transmissions of data on the serial
port,
Why not "lift" the OnKeyPress handler while it is handling an
event ...
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
Self.OnKeyPress := nil; // stop further keypresses triggering the
event
//
// your event handling code
//
Self.OnKeyPress := Self.FormKeyPress; // restore keypress events
end;
Alan Lloyd
.
- References:
- Keypress Event problem
- From: Paul E. Schoen
- Keypress Event problem
- Prev by Date: Re: Keypress Event problem
- Next by Date: xp64
- Previous by thread: Re: Keypress Event problem
- Next by thread: xp64
- Index(es):