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 + AddItem (https://www.delphipraxis.net/64943-combobox-additem.html)

bwolf 10. Mär 2006 09:28


Combobox + AddItem
 
Hi Leute,

habe eine Frage zu Comboboxen an euch:

Ich würde gerne mit AddItem einen String und eine Zahl hinzufügen (quasi den Wert und die ID dazu).
cmb_schularten.AddItem('test',23);
Allerdings will addItem als 2. Parameter ja ein tObject - wie kann ich einen Int als Object parsen und umgekehrt?
Oder sollte man das eh anders machen?

Vielen Dank schonmal,
greets ben

Luckie 10. Mär 2006 09:33

Re: Combobox + AddItem
 
Guck dir das mal an: http://www.michael-puff.de/Developer...AddObject.html

Sharky 10. Mär 2006 09:36

Re: Combobox + AddItem
 
Hai bwolf;

setzen:
Delphi-Quellcode:
var
  mystring : string;
  zahl : integer;
begin
  mystring := 'blubb';
  zahl := 10;
  ComboBox1.AddItem(mystring,TObject(zahl));
auslesen:
Delphi-Quellcode:
var
  mystring : string;
  zahl : integer;
begin
  mystring := ComboBox1.Items[ComboBox1.ItemIndex];
  zahl := Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]);

bwolf 10. Mär 2006 10:08

Re: Combobox + AddItem
 
10000 Dank für diese schnellen und hilfreichen Antworten :thumb:

grüße,
ben


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

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