[Lazarus] How to associate an object with a row in TStringGrid
dec12 at avidsoft.com.hk
Wed Sep 3 18:03:37 CEST 2014
Giuliano Colla wrote:
> Il 03/09/2014 10:17, Dennis ha scritto:
>> when displaying data in a TStringGrid, I want to associate an object
>> with each row of the grid so that when later use select a certain
>> row, I can just determine the selected row and then retrieve the
>> associate object for further processing (e.g. display further
>> information of this object in some controls).
>> How do I do that?
>> Currently, I use OnSelection (Sender: TObject; aCol, aRow: Integer)
>> to obtain aRow but how do I associate an object with each row?
> StringGrid1.Rows.AddObject('some text',anObject);
But I checked,
StringGrid1.Rows is a TStrings
seems to add an object to the last item in this TStrings instead of
just one object for the entire row.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Lazarus