Attaching Structures to StringGrid Rows

Please discuss general Delphi programming topics here.

Attaching Structures to StringGrid Rows

Postby everclearmind » May 21st, 2003, 4:01 pm

I have a little problem, i have created a linked list using a structure called TProduct, but what i'm trying to accomplish is to attach a TProduct structure Node to each row of a StringGrid componet, so when a user selects the row, it will be able to reference the TProduct directly instead of requiring any search algothrums. Could anybody help me PLEASE!!! :roll:
I assume you might be able to use TObject inside the class of TString, but am quite confused.

Thank you,
Jeramy - EverClearMind
everclearmind
Member
Member
 
Posts: 2
Joined: May 21st, 2003, 3:55 pm
Location: Cornwall, UK

TStringGrid.Objects[]

Postby richardchaven » May 30th, 2003, 1:37 pm

Use the TStringGrid.Objects[Col, Row] property to store objects.

Note: you must have text in the Cells[Col, Row] or the object pointer goes away too; you can have a single space, but it cannot be an empty string.

I agree that having a separate list of objects (in order to free them all) is much better than iterating the Objects property and freeing anything you find.

BTW: why a linked list instead of TCollection?

Cheers
richardchaven
Active Member
Active Member
 
Posts: 20
Joined: May 30th, 2003, 1:30 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron