Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Fr 20.09.02 22:59 
Hi,
wie kann ich einen gewählten Item in einer ListBox in einer ComboBox anzeigen?BSP-Code?
Danke
Gruss
majolo
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 20.09.02 23:53 
Den Index des gewählten Items bekommst Du mit der Eigenschaft ItemIndex. Mit der Eigenschaft Items erhälst Du dann den String. Diesen kannst dann mit der Methode Add in der ComboBox einfügen!

Gruß
TINO
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Sa 21.09.02 11:18 
Hi,

Die Einträge in der ListBox und ComboBox sind identisch.Also kann ich mir das nochmalige hinzufügen doch sparen.Ich möchte nur click Lisbox zb Eintrag7 dann soll in der ComboBox der identische Eintrag angezeigt werden.
Gruss
majolo
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Sa 21.09.02 12:12 
Die Komponente ComboBox hat meines Wissens nach eine Eigentschaft namens Text. Und da kannste den aktuellen Eintrag anzeigen lassen.

_________________
Viele Grüße
Jakob
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 21.09.02 12:38 
majolo hat folgendes geschrieben:
dann soll in der ComboBox der identische Eintrag angezeigt werden.

Wirklich angezeigt oder doch selektiert werden?
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Sa 21.09.02 16:51 
Sowohl angezeigt, als auch selektiert werden.Mit der eigenschaft Text ist das kein Problem, nur dann ist der Eintrag wie gesagt nicht selektiert in der ComboBox, sondern wird nur angezeigt.
gruss
majolo
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 22.09.02 11:02 
Wenn Du in beiden Komponenten die gleichen Einträge hast dann kannst Du doch bei dem OnClick-Event der Listbox das ItemIndex der ComboBox zuweisen:
ausblenden Quelltext
1:
2:
3:
4:
procedure form1.ListBox1Click (Sender: tObject);
begin
  ComboBox1.ItemIndex := ListBox1.ItemIndex;
end;

Gruß
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mo 23.09.02 18:09 
Danke Tino,

so habe ich es schlußendlich auch gelöst ganz vergessen zu posten,dass ich es selbst gelöst habe.Hoffe habe dir jetzt keine unnötige Arbeit gemacht.
Gruss
majolo
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 23.09.02 23:56 
Kein Problem!

Gruß
TINO