Hello,
Thanks for the problem report.
At the moment this is what I see as working correctly, see
https://github.com/Steema/TeeGrid/blob/ ... _Array.pas
Code: Select all
// Setup grid Footer bands
var tmp : TColumnTotals;
TeeGrid1.Footer.Clear;
tmp:=Totals(TeeGrid1.Footer);
calls:
Code: Select all
// Return a new Totals grid-band
function Totals(const ACollection:TCollection):TColumnTotals;
begin
result:=TColumnTotals.Create(ACollection);
result.Calculation.Add('Name',TColumnCalculation.Count);
result.Calculation.Add('Children',TColumnCalculation.Sum);
result.Calculation.Add('Height',TColumnCalculation.Average);
result.Calculation.Add(result.Columns['Address'].Items['Number'],TColumnCalculation.Max);
result.Format.Font.Style:=[fsBold];
end;
The syntax/overload you referenced also works ok in this demo.
ie.
Code: Select all
TeeGrid1.Totals.Calculation.Add( TeeGrid1.Columns['kilograms'] , TColumnCalculation.Sum );
or in this case for example:
Code: Select all
tmp:=TColumnTotals.Create(TeeGrid1.Footer);
tmp.Calculation.Add(TeeGrid1.Columns['Children'],TColumnCalculation.Sum);
The key to the difference seems to be the use of "tmp as TColumnTotals", rather than calling "TeeGrid1.Totals" (unfound by the compiler). I'll look around for examples; that may be old syntax as you suggest or simply an error where we have it included in documentation. We'll change examples we find for the new syntax.
Regards,
Marc