Author: Tomas Rutkauskas
I want to store a second string in a combobox item. How can I do this without
defining an object wrapper?
Answer:
1 2 procedure AddString(const S1, S2: string; Items: TStrings);
3 var4 Obj: TObject;
5 begin6 Obj := nil;
7 string(Obj) := S2;
8 Items.AddObject(S1, Obj);
9 end;
10 11 procedure DeleteItem(const I: Integer; Items: TStrings);
12 var13 Obj: TObject;
14 begin15 Obj := Items.Objects[I];
16 Items.Objects[I] := nil;
17 string(Obj) := '';
18 end;
Just be sure to go over every item and release the string.