Autor Beitrag
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 26.12.05 16:38 
Hallo Leute !
Ich möchte gern das er mir die Worte aus Rich Edit in die Listbox schreibt aber erst, wenn Edit1 > als 1 Zeichen ist aber leider funktioniert das nicht so Recht.
Hat einer ne Ahnung woran das liegen könnte.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.RichEdit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Edit1.Text >' ' then
 begin
  if Key = VK_SPACE then Listbox1.Items.Add(Edit1.Text);
  if Key = VK_SPACE then Edit1.Clear;

  if Key = VK_RETURN then Listbox1.Items.Add(Edit1.Text);
  if Key = VK_RETURN then Edit1.Clear;

  if Key = VK_BACK then Edit1.Text := Copy(Edit1.Text, 1, Length(edit1.Text) - 1);
 end;
end;


Hat sich erledigt habs hinbekommen (length(Edit1.Text) < 2) !


Zuletzt bearbeitet von Blackheart666 am Mo 26.12.05 17:35, insgesamt 1-mal bearbeitet
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: Mo 26.12.05 17:35 
versuchs mal mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
If Length(EDit1.Text) > 1 Then
begin  
  if Key = VK_SPACE then Listbox1.Items.Add(Edit1.Text);  
  if Key = VK_SPACE then Edit1.Clear;  

 
  if Key = VK_RETURN then Listbox1.Items.Add(Edit1.Text);  
  if Key = VK_RETURN then Edit1.Clear;  

 
  if Key = VK_BACK then Edit1.Text := Copy(Edit1.Text, 1, Length(edit1.Text) - 1);  
 end;


so wie du das hattest wird überprüf ob der string größer is als ein leerzeichen...
Blackheart666 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 26.12.05 17:40 
Danke Ironwulf da warn Wir wohl Zeitgleich.
Hatte gerade meinen Beitrag editiert, das sich das erledigt hat. Aber trotzdem Danke.