How can I change the Delay before triggering the OnKeyDown-Event after it was triggered once in Delphi/FMX?

  

I’m sorry, but it seems like I have a beginner problem again, but i didn’t found a solution to it online or in the help section:

I want to use the OnKeyDown Event to do something (Different things, so i need a general solution), as Example to increase a number in a label.
My code for this would look the following:

Var i : Integer = 0;

procedure TExampleForm.FormKeyDown(Sender: TObject; var Key: Word;
var KeyChar: Char; Shift: TShiftState);

begin
Inc(i);
ExampleLabel.Text:=IntToStr(i);
end;

If i press and hold a Key in the actual program, it will trigger the event just once immediately, and then it will trigger the event after a short delay many times, exactly how it should: The problem is, that i dont want this delay after the first trigger of the event and these, which are caused by the holding of the button. Is there any way to stop Delphi (Or probablly the Keyboard) from behaving like this? I would really appreciate a solution, thanks for your time and effort!

Comments are closed.