Hi All,
I'm adding grouped lines in a stringgrid through the OnDrawCell event, I'm not creating a new component (yet).
I use the first column (0) as storage for the row's settings.
The grouped lines work fine (kinda like merge fields), so I decided to make those groups collapsable and expandable.
As there is no "RowHide" function, I do something like this in the OnDrawCell routine:
if (Sender as TStringGrid).Cells[0, aRow] = 'Hidden' then
begin
(Sender as TStringGrid).RowHeights[aRow] := 0;
(Sender as TStringGrid).Canvas.FillRect(aRect);
end
else
begin
(Sender as TStringGrid).RowHeights[aRow] := (Sender as TStringGrid).DefaultRowHeight;
(Sender as TStringGrid).Canvas.FillRect(aRect);
end;
The problem is, that once set RowHeights[aRow] to 0 (to hide the row), there is now way to set it back to normal: the row will not display.
If I set RowHeights[aRow] to 1, it works, but I get a 1px line for every row, which isn't "estétique"...
I already searched the grid.pas for a way to solve this, but I can't seem to find why this is happening.
I hope someone can shed a light on this.
Thanks,
Frank.