Mirror

How to implement delayed autotyping in a TDBEdit or TEdit (Views: 100)


Problem/Question/Abstract:

Using a TDBEdit, I would like to achieve something like this on user input:
S ... (wait a few milliseconds) ... O ... (wait) ... M ... (wait) ... E

Answer:

procedure SendtextToControl(control: TWinControl; const S: string; interval: Integer {milliseconds});
var
  i: Integer;
begin
  for i := 1 to Length(S) do
  begin
    control.perform(WM_CHAR, Ord(S[i]), 0);
    control.Update;
    if i < Length(S) then
      Sleep(interval);
  end;
end;

<< Back to main page