EXAMPLE 49
TAdvStringGrid
example 49 : auto calculating floating footers
It is now very convenient to show automatically calculated values
in the fixed floating footer of TAdvStringGrid. Automatic
calculations of column sum, column minimum, column maximum,
column average and column rowcount can be easily added. Only 2
steps are required to enable this :
grid.FloatingFooter.Visible := True; // show the floating footer grid.FloatingFooter.ColumnCalc[colindex] := CalcType; // set the calculation type for the column colindex in the floating footer.
The calculation type CalcType can be:
acCount: show rowcount
acSum: show column sum
acAvg: show column average
acMin: show column minimum
acMax: show column maximum
As such, the sample app's setup was done with:
procedure TForm1.FormCreate(Sender: TObject); begin AdvStringGrid1.FloatingFooter.ColumnCalc[0] := acCount; AdvStringGrid1.FloatingFooter.ColumnCalc[1] := acSum; AdvStringGrid1.FloatingFooter.ColumnCalc[2] := acAvg; AdvStringGrid1.FloatingFooter.ColumnCalc[3] := acMin; AdvStringGrid1.FloatingFooter.ColumnCalc[4] := acMax; AdvStringGrid1.RandomFill(False,100); AdvstringGrid1.AutoNumberCol(0); end;
Whenever a cell changes through editing or through loading, the automatically recalculated value shows in the floating footer.
Delphi project & source files for downloading included in the main demos distribution for Delphi.
The project and source files have been written with Delphi 6,7. To use these files in other versions of Delphi, ignore any remarks when opening the form files and save the files. After this, compilation can be done. The error messages are due to properties included in the Delphi 6 form file, but not available in lower versions of Delphi.


ONLINE ORDERS
Subscribe to RSS Feed