Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Combobox -> Property Text -> Property Style:=csDropDownList? (https://www.delphipraxis.net/7389-combobox-property-text-property-style-%3Dcsdropdownlist.html)

hitzi 11. Aug 2003 10:36


Combobox -> Property Text -> Property Style:=csDropDow
 
Hallo,

Wie kann ich einer Combobox einen Text zuweisen, wenn Combobox.Style:=csDropDownList ist.

Delphi-Quellcode:
Combobox1.Text := 'Test';
Wird ohne Fehler ausgeführt, aber der Text der Combobox1 bleibt leer.
Wenn ich jedoch ein Item mit der Maus auswähle erscheint das ausgewählte Item in Combobox1.Text.

Hintergrund:

Ich fülle eine Combobox mit mehreren Items. Beim ersten Start soll standardmäßig das erste Item ausgewählt sein. Der Benutzer soll keinen eigenen Text in der Combobox eingeben können, deshalb Style = csDropDownList.

Mein bisheriger Code:
Delphi-Quellcode:
if cb_DB.Items.Count > 0 then begin
  cb_DB.Text := cb_DB.Items[0];
  //einige Datenbank aufrufe auf Basis der Comboboxauswahl (cb_DB)
end;
Wie kann ich dieses Problem lösen?

MfG Hitzi

Alexander 11. Aug 2003 10:40

Re: Combobox -> Property Text -> Property Style:=csDro
 
Kuck dir mal ITemIndex an.

hitzi 11. Aug 2003 10:42

Re: Combobox -> Property Text -> Property Style:=csDro
 
Vielen Dank. Funktioniert.

MfG Hitzi


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:41 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz