Autor Beitrag
galbe19
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Sa 07.07.07 17:42 
Hallo

wie kann ich es machen das ich auf Button1 nur clicken kann wenn ich in einem edit etwas geschrieben habe?

mfg
alex
ololo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41



BeitragVerfasst: Sa 07.07.07 17:49 
das ist nicht so schwer:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if Edit1.Text = '' then
   Button1.Enabled := false
else
   Button1.Enabled := true;


das ganze tust du in nen timer
(ich hoffe es stimmt alles so :D )
DaK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Win 2000, Windows XP
Delphi 2007 Professional
BeitragVerfasst: Sa 07.07.07 17:59 
ausblenden Delphi-Quelltext
1:
Button1.Enabled := Edit1.Text <> ''					


Ich würde es eher ins OnChange-Ereignis des Edit-Feldes packen.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Sa 07.07.07 18:11 
user profile iconDaK hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
Button1.Enabled := Edit1.Text <> ''					


Ich würde es eher ins OnChange-Ereignis des Edit-Feldes packen.

Stimmt, das hier ist die weitaus elegantere Methode.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Sa 07.07.07 21:50 
Das mit dem Timer ist nicht gut. Ich würde auch das OnChange-Event vorziehen. :wink:
Zitat:

Wieder was neues gelernt: Wusste gar nicht, dass du bei Zuweisungen vergleichen kannst...