Autor Beitrag
personX
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 19

WIN 2000
Delphi 2006
BeitragVerfasst: Do 16.03.06 20:08 
Hallo zusammen,
ich habe da folgende Frage bei der Programmierung eines Adressbuches. Dazu habe ich eine Listbox verwendet. Die Frage ist nun: Wie kann ich erreichen, dass die Edits auf dem Formular mit (bereits vorhandenem) Text gefüllt werden, sobald ein Item der Listbox ausgewählt bzw. blau hinterlegt wird.
Ich hoffe, jemand kann mir weiterhelfen.


Moderiert von user profile iconTino: Topic aus Sonstiges (Delphi) verschoben am Do 16.03.2006 um 22:28
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 16.03.06 20:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ListBox1Click(Sender: TObject);
begin
 edit1.Text := listbox1.Items.Strings[listbox1.Itemindex];
end;


hoffe das hillft dir weiter ;)

oder du machst es mit case
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
begin
 case listbox1.Itemindex] of
  0: edit1.text := ...
  1: edit1.text := ...
  ...
end;
personX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 19

WIN 2000
Delphi 2006
BeitragVerfasst: Do 16.03.06 20:38 
Ich bin's wieder!
Tut mir leid, ich habe mich ein bisschen falsch ausgedrückt. Das Problem liegt nicht bei der Edit-Zuweisung. Ich würde vielmehr wissen, wie es möglich ist, dass das Programm erkennt, von welchem Item der Listbox es die Daten nehmen soll.
Trotzdem danke für deine Antwort :-)
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Do 16.03.06 20:44 
user profile iconNoTVerYEvilPzYchO hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ListBox1Click(Sender: TObject);
begin
 edit1.Text := listbox1.Items.Strings[listbox1.Itemindex];
end;


damit sollte das doche eigentlich gehen :wink:
personX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 19

WIN 2000
Delphi 2006
BeitragVerfasst: Do 16.03.06 20:50 
Achso, dann steht "Itemindex" also für die markierte Stelle.
Vielen Dank an alle!