Can't implement Totals using C++

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
PCZ
Newbie
Newbie
Posts: 9
Joined: Mon Jul 30, 2018 12:00 am

Can't implement Totals using C++

Post by PCZ » Thu Aug 02, 2018 2:04 am

Hello,

I want to add totals to my grid using C++ but can't do that.
I'm using the example of the getting started guide under "Totals and SubTotals" title, but it is Delphi code.
When I try to translate this code to C++ it fails because the following error message: "undefined symbol TColumnsTotals".
Could you show me how can I implement totals in C++?

Thanks in advance,
Patricio

PCZ
Newbie
Newbie
Posts: 9
Joined: Mon Jul 30, 2018 12:00 am

Re: Can't implement Totals using C++

Post by PCZ » Fri Aug 10, 2018 12:59 am

PCZ wrote:
Thu Aug 02, 2018 2:04 am
Hello,

I want to add totals to my grid using C++, but I can't do that.
I'm using the example of the getting started guide under "Totals and SubTotals" title, but it is Delphi code.
When I try to translate this code to C++ it fails because the following error message: "undefined symbol TColumnsTotals".
Could you show me how can I implement totals in C++?

Thanks in advance,
Patricio
No one has knowledge about how to use TeeGrid with C++ Builder that could help me?
Any help or tip would be appreciated.

Regards,
Patricio

Marc
Site Admin
Site Admin
Posts: 1266
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Can't implement Totals using C++

Post by Marc » Thu Oct 11, 2018 11:17 am

Hello Patricio,

Apologies for having left you unattended with you query.

For the record; an example of implementation of totals by code in C++ would be as follows:

Code: Select all

#include "Tee.Grid.Totals.hpp"

TGridFooter *footer = TeeGrid1->Footer;
TColumnTotals *totals = new TColumnTotals(footer);

totals->Calculation.Clear();
totals->Calculation.Add(TeeGrid1->Columns->Items[0],Sum); //or Count, etc
The Column may be accessed by name.

Regards,
Marc Meumann
Steema Support

PCZ
Newbie
Newbie
Posts: 9
Joined: Mon Jul 30, 2018 12:00 am

Re: Can't implement Totals using C++

Post by PCZ » Fri Dec 21, 2018 8:05 pm

Hi Marc,

Unfortunatelly I have an error message using exactly the same sample code that you sent me (except for the name of the grid.
This is my code:

Code: Select all

// These lines are present from previous versions
//---------------------------------------------------------------------------
#include "Tee.Painter.hpp"
#include "VCLTee.Editor.Grid.hpp"
#pragma package(smart_init)
#pragma link "VCLTee.Control"
#pragma link "VCLTee.Grid"
#pragma link "VCLTee.Editor.Grid"
#pragma link "Tee.GridData.Strings"
//---------------------------------------------------------------------------
#include "Tee.Grid.Totals.hpp"
TGridFooter *footer = TG_RepCateg->Footer;
TColumnTotals *totals = new TColumnTotals(footer);
totals->Calculation.Clear();
totals->Calculation.Add(TG_RepCateg->Columns->Items[i],Sum);
And this is the error message:
[bcc32 Error] Reportes.cpp(402): E2285 Could not find a match for 'TColumnTotals::TTotals::Add(TColumn *,double (_fastcall *)(const double *,const int))'
Full parser context
Reportes.cpp(274): parsing: void _fastcall TF_Reportes::QueryReporteEvolutivo(int,int,int,int,TTeeGrid *)

Could you help me?

Best regards,
Patricio Cerda

Marc
Site Admin
Site Admin
Posts: 1266
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Can't implement Totals using C++

Post by Marc » Mon Jan 07, 2019 5:06 pm

Hello Patricio,

Yes the code looks ok though it doesn't appear to be locating the correct definition for Add.

ie. in Tee.Grid.Totals.hpp

Code: Select all

void __fastcall Add(Tee::Grid::Columns::TColumn* const AColumn, const Tee::Griddata::TColumnCalculation ACalculation)
Please could you check that the debugger takes you to that definition.

Regards,
Marc
Steema Support

Post Reply