I am facing an issue with TTMSFNCGrid while show/hide rows as parent/child.
We are showing 10 Rows as Parent Rows and on Cell Click adding /hiding the Child Rows for example Showing Total Row and the Sub Total (Expand/Collapse)
When Expand and Collapse the first Row, it seems to be working fine, but when we expand/collpase 3,4 or 5th row everything gets mixed up with parent row
I am using the below code. row 1 is working fine. but row 7 is not working properly.
procedure TfrmTest.FormCreate(Sender: TObject);
var
I: Integer;
Ptr: ^Boolean;
begin
Grd.RowCount := 10;
Grd.ColumnCount := 1;
for I := 0 to Grd.RowCount - 1 do
begin
Grd.Cells[0,I] := IntToStr(I);
if I In [1,7] then
begin
Grd.AddBitmap(0,I,'Plus');
New(Ptr);
Ptr^ := True;
Grd.Objects[0,I] := TObject(Ptr);
end;
end;
end;
procedure TfrmTest.GrdFixedCellClick(Sender: TObject; ACol, ARow: Integer);
var
Ptr: ^Boolean;
begin
if Grd.IsBitmap(ACol,ARow) then
begin
if Grd.GetBitmapName(ACol,ARow) = 'Plus' then
begin
Grd.AddBitmap(ACol,ARow,'Minus');
Ptr := Pointer(Grd.Objects[ACol,ARow]);
if Ptr^ then
begin
Grd.InsertRows(ARow + 1,2);
Ptr^ := False;
Grd.Objects[0,ARow] := TObject(Ptr);
end
else
Grd.UnHideRows(ARow + 1,2);
end
else
begin
Grd.AddBitmap(ACol,ARow,'Plus');
Grd.HideRows(ARow + 1,2);
end;
end;
end;
We have tested this here with the following code and clicking on row 7 shows and hides correctly:
procedure TfrmTest.GrdFixedCellClick(Sender: TObject; ACol, ARow: Integer);
var
Ptr: ^Boolean;
begin
Grd.BeginUpdate;
if Grd.IsBitmap(ACol, ARow) then
begin
if Grd.GetBitmapName(ACol, ARow) = 'Plus' then
begin
Grd.AddBitmap(ACol, ARow, 'Minus');
Ptr := Pointer(Grd.Objects[ACol, ARow]);
if Ptr^ then
begin
Grd.InsertRows(ARow + 1, 2);
Ptr^ := False;
Grd.Objects[0, ARow] := TObject(Ptr);
end
else
Grd.UnHideRows(ARow + 1, 2);
end
else
begin
Grd.AddBitmap(ACol, ARow, 'Plus');
Grd.HideRows(ARow + 1, 2);
end;
end;
Grd.EndUpdate;
end;
We are still not able to reproduce this issue here, with the modified code above. Clicking on row 1 shows 2 rows below it, clicking on row 7 also shows 2 rows below it, without gaps or anything else. Note that we have recently changed the way the grid works with hidden and displayed rows and columns. I suggest to await the next version and then try again.
Also CellControls property is missing in TMSFNCGrid which is available in TMSAdvStringGrid/ TMSFMXGrid. Can I get that too in next version. Also when can I expect tne new version?
CellControls is currently not supported. When time permits, we'll investigate the possibilities. FNC is based on pure painting and does not work with child controls. The next version is still being worked on. We'll see when we can fit in a release.
CellControls property is there in TMSFMXGrid pdf manual. I went for FNC pack instead FMX pack hoping all provisions of FMX pack will be available in FNC. Can I get FMXGrid?
Hide/Unhide row issue I found in FNCGrid is not found in AdvStringGrid. So I believe the issue will not be there in FMXGrid. Can I swap FMXGrid for FNCGrid? I did not get response for my earlier post.