Good morning to all,
i have a problem with floating footer.
I use the grid without the floating footer (FloatingFooter.visible := false) without any problem, but when i try to use it (Floatingfooter.visible:=True) i have a strange problem;
At the grid's bottom a fixed row is added (ok) with all the columns (fsFixedLastRow), but when i try to load the grids's row, the grid remain empty and only the fixedrow has the column data.
grid setting
gorowselect:=true, goediting:=false, fixedrowalways:=true
Here the procedure to load the grid data (sg2 is TadvStringGrid)
procedure loadgrid;
Var I : Integer;
begin
SG2.Clear;
SG2.ColCount:=2;
SG2.RowCount:=1;
SG2.Cells[ColGruppo,0]:='Codice';
for I:=1 to 20 do
Begin
SG2.AddRow;
SG2.Ints[1,SG2.LastRow]:=I;
End;
end;
All the rows are added but are empty and the footer is filled with the last value, column header is displaied good.
so i tried with SG2.Ints[1,SG2.LastRow - ]:=I;
In this case the rows are added but, the col header is the first value (1) and on the footer there is the column header.
Sure i miss something ...
Thank's for attention
Daniele
Grid version 8.3.5.2
Delphi Seattle / Tokyo
Hi,
solved with this
procedure loadgrid;
Var I : Integer;
begin
SG2.Clear;
SG2.ColCount:=2;
SG2.RowCount:=1;
SG2.FloatingFooter.Visible:=False; // footer is disabled ...
SG2.Cells[ColGruppo,0]:='Codice';
for I:=1 to 20 do
Begin
SG2.AddRow;
SG2.Ints[1,SG2.LastRow]:=I;
End;
// Before reactivate the footer add a new row
SG2.AddRow;
SG2.FloatingFooter:=True; // Activate the footer on last blank row
end;
** NOTE
Now SG2.LastRow return the very last grid row and it's is floatingfooter row instead the last usable row (sg2.Rowcount - 2).
If possible can make something like
function TAdvStringGrid.GetLastRow: Integer;
begin
if FFloatingFooter.Visible then Result := RowCount - 2
else
Result := RowCount - 1;
end;
For now, if use lastrow, footervisible false/true must be setted before any operation on add/delete grid row.
I did not test it on hide/unhide rows.
Thank's for your attention
Daniele