Autor Beitrag
Florian.K
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

Win Xp Prof. & SP 2
Delphi 10 Lite
BeitragVerfasst: Mo 12.06.06 21:18 
Hi Community,
Ich habe einen Timer der mir bestimmte Tasten simuliert.
Dies geschieht durch aktivierung des Timers.
Ist es möglich den Intervall des Timers in einem Editfeld zu definieren?
Danke im Voraus
Florian
fidionael
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 232

Win XP SP2, Ubuntu 6.06
Delphi 7 PE, Delphi 3 Prof
BeitragVerfasst: Mo 12.06.06 21:36 
Klar, warum nicht? Ich würde aber nicht unbedingt über das OnChange-Event des Edits gehen, da dann Fehlermeldungen auftreten wenn du dich vertippst oder den inhalt deines Edits löscht. Ich würde den Umweg über einen entsprechenden Button machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button1Click(Sender: TObject);
var MyInterval: Integer;
begin
  if TryStrToInt(Edit1.Text,MyInterval) then
    Timer1.Interval:=MyInterval
  else
    MessageBox(Handle,'Ungültige Eingabe!',pChar(Caption),MB_ICONERROR);
end;


Mfg

Edit 1:
Habe mal die Variable s aus dem Quelltext entfernt, da diese nicht notwendig ist und wohl eher Verwirrung stiften als helfen könnte.

@user profile iconThe Who: Sehr richtig :P


Zuletzt bearbeitet von fidionael am Mo 12.06.06 21:41, insgesamt 1-mal bearbeitet
The Who
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 25

Win XP Prof
D3 Prof, D8, D7E
BeitragVerfasst: Mo 12.06.06 21:37 
Ja

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1Change(Sender: TObject);
begin
Timer1.Interval := strtoint(edit1.Text);
end;




//Edit: LOL ich war mal wieder zu langsam :(
Florian.K Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

Win Xp Prof. & SP 2
Delphi 10 Lite
BeitragVerfasst: Mo 12.06.06 22:04 
Dange = ]