Autor Beitrag
Mischel24NRW
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40



BeitragVerfasst: So 13.11.05 12:55 
Tach zusammen!

Folgendes Problem:

Ich möchte in einer Dropdownlist-Combobox einen Eintrag auswählen und diesen bei Betätigung einer Schaltfläche in einer anderen Combobox einfügen. Ich hab das mal so versucht aber es klappt net:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  combobox2.items.add(combobox1.SelText);
end;



Dabei gehe ich davon aus, dass .SelText für den ausgewählten Text steht, weiss das aber nicht genau...

Ob mir da vielleicht jemand helfen könnte?


Vielen Dank schonmal

Moderiert von user profile iconGausi: I- durch Delphi-Tags ersetzt
Moderiert von user profile iconraziel: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 13.11.2005 um 12:53
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 13.11.05 12:58 
Moin und :welcome: im Forum!

Mach das mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject); 
begin 
  ComboBox2.Items.Add(ComboBox1.Items.Strings[ComboBox1.ItemIndex]); 
end;

cu
Narses
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 13.11.05 13:05 
Combobox1.Text ist der aktuell oben im Feld angezeigte Text., wenn Du den User etwas benutzerdefiniertes eingeben lässt. Bei Stylr=fixed geht es so, wie mein Vorredner das erwähnt hat.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Mischel24NRW Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40



BeitragVerfasst: So 13.11.05 13:06 
Erstmal vielen Dank für die herzliche Begrüßung :-)

Also so, wie du das geschrieben hast funktioniert es auch! Hab aber zwischenzeitlich auch noch das hier ausprobiert:

combobox2.items.add(combobox1.text);

Und das funktioniert auch! Was ist dennd er Unterschied dazwischen? Also so auf den ersten Blick würde ich sagen ist die Funktion identisch....
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 13.11.05 13:10 
Moin!

Schau doch mal in die Online-Hilfe; Ansätze, was du da nachlesen könntest, haben wir dir doch jetzt schon genug gegeben... :wink:

cu
Narses