6

Can anyone recommend a good stringgrid like component for Delphi that handles comments on each cell similar to Microsoft Excel? I am searching the web but haven't found much yet and would appreciate input if someone here has used something similar

Updated with images: Cell 1A has a comment, as indicated by red triangle

cell with a comment

A mouseover reveals the comment on the cell

enter image description here

Joe
  • 999
  • 1
  • 8
  • 20

1 Answers1

6

You can use the existing TStringGrid component. Use its Objects property to store custom per-cell data, such as a comment String, and then you can use the THintWindow class to display that comment to the user when needed.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • That sounds promising. I was already placing values in my grid using StringGrid.Cells[x,y] := value. Is there a way to store a comment alongside that value? Or would I need another grid? Also what would be a good way in this case to indicate to the user that there is a comment in on the cell? (Excel uses the red triangle in the corner) – Joe Jan 18 '12 at 00:09
  • 1
    Sorry, I meant the `Objects` property, not the `Cells` property. I have updated my answer. As for displaying an indicator to the user, I would owner-draw the cells using the `OnDrawCell` event. Whenever a comment has been stored in the `Objects` property, you can draw whatever kind of indicator you want in the cell. – Remy Lebeau Jan 18 '12 at 01:05