delphi xe2 stringgrid with comments
Asked Answered
R

1

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

Rune answered 17/1, 2012 at 22:51 Comment(2)
Maybe you can add a picture to make this clearer? I am not sure what "similar to excel" means here.Dyscrasia
+1 for adding a picture, that helps.Dyscrasia
R
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.

Raven answered 17/1, 2012 at 23:29 Comment(2)
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)Rune
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.Raven

© 2022 - 2024 — McMap. All rights reserved.