TComboBox - 2 Values in one Row lazarus / 8-Other ---------------------------------------------------------------------- ankro · 2005-11-18 09:27 Hello everybody, i'd a Problem with the TComboBox. I want to put in one Row 2 Values, one visible and one hidden. To Add an Item in the TComboBox i do that: Code: [Select]      ComboBox1.Items.Add('Testitem'); But now i need to assign the "Testitem" a value like 3. The "Testitem" must now be visible and 3 must be assigned in background to the "Testitem" because i need this value to update or delete the row in my sqlite3 db. I tried several things, but all with no success. To not delay my project i choose the alternative StringGrid. Here can i assign multiple values with the ".Cells Property" in the same row and hide the ID Column with the Value '3'. But the StringGrid handling is not so easy for the users. Is it generally possible to to this with the TCombo, TList or any other list Components? Thank you for answering, and sorry if the question is stupid, but i'm a newbie in lazarus. greetings ankro ---------------------------------------------------------------------- Marc · 2005-11-18 10:54 Since Items is a TString decendant, you can use the object part of it like Code: [Select]ComboBox1.Items.AddObject('Testitem', TObject(Pointer(3))); (sorry for the ugly casts) ---------------------------------------------------------------------- ankro · 2005-11-19 13:38 Thank you for answer, but what must i do now to get this value? I tried it with the GetObject Function, but i have no idea what values i must enter in the Index:Integer area? Or is there another way to get the value from the pointer, like this: Code: [Select] id_value = ComboBox1.GetValuefromIndex(3); sqlQuery := 'Update ......... where id_value=+id_value+'; Any Idea, searching in the lazarus forum brings no solution best greetings from the snowy germany ankro ---------------------------------------------------------------------- Marc · 2005-11-21 13:52 like Combobox1.Items[3] returns the string at index 3, Combobox1.Items.Objects[3] returns the object at that index. (THis is the case for all TStrings decendants) Since you put a casted integer in it, you need to cast to get it out again. id_value := Integer(Combobox1.Items.Objects[3]) ---------------------------------------------------------------------- ankro · 2005-11-21 14:22 Thank you for help, Marc. Now i understand a little bit more greetings ankro