Autor Beitrag
Michael15
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 10.05.05 19:48 
Wie kann man es erreichen, das immer wenn in einem Edit nichts drinsteht
(edit1.text = '') dass dann ein String z.B. Nachname darin steht.

Also
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if edit1.text = '' then 
       begin
       form1.edit1.text = 'Vorname';
       end;


Aber das soll immer der Fall sein, nicht nur beim ersten mal.
Danke

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 10.05.05 19:53 
Das könntest Du mit einem Timer machen oder im OnChange-Ereignis der Edit.

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: Di 10.05.05 19:54 
Überprüfs doch einfach mit einem Timer.
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 10.05.05 20:21 
und wie geht das???
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: Di 10.05.05 20:26 
Einfach einen Timer auf die Form der konntroliert dann ob das Editfeld leer ist.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Edit1.Text = '' then Edit1.Text:='Vorname';
end;
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 10.05.05 20:43 
danke, das funktioniert, es wäre aber noch schöner wenn der Timer erst nach 5 Sekunden aktiviert wird, d.h wenn das Edit 5 sek. leer ist soll es mit Vornam gefüllt werden.
Danke
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 10.05.05 20:55 
Dann stellst du einfach den Timer auf 5 Sekunden. Das geht im Objektinspektor oder zum Laufzeit mit  Timer1.Interval := 5000;

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Di 10.05.05 21:10 
Warum wollt ihr immer alles mit einem Timer lösen?

Das Edit hat doch genug andere Ereignisse: onchange(wie bereits genannt) oder onexit wo man das eleganter lösen kann

Mfg frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Di 10.05.05 22:06 
Ich würde das auch mit onExit machen, ist ressourcenschonender

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Edit1Exit(Sender: TObject);
begin
if (edit1.Text := '') or (edit1.Text = ' ') then edit1.Text := 'Vorname';
end;