Page 1 of 1

TChartSeries OnGetMarkText causing compiler error

Posted: Wed Dec 15, 2010 10:03 pm
by 16456426
I have TeeChart Pro v2010 VCL version installed

I am taking a TChart from an old project using old version of C++ Builder Version 5, and moving it to C++ Builder 2009. The code worked in the old version. When I bring it to the new version I get a compiler error.

// Here's the method in my class
void __fastcall TGraphForm::OnGetMarkText_G(TChartSeries* Sender, int ValueIndex, AnsiString &MarkText)
{
if(Sender->XValues->Value[ValueIndex] > 1.0)
Sender->Marks->BackColor = clRed;
else
Sender->Marks->BackColor = Sender->SeriesColor;
}

// this is a code snippet from another part of the code
// pS is declared as a TChartSeries *
TChartSeries *pS

// later in the code
pS->OnGetMarkText = OnGetMarkText_G;

Here's the compiler error I get:
[BCC32 Error] Graph.cpp(195): E2034 Cannot convert 'void (_fastcall * (_closure )(TChartSeries *,int,AnsiString &))(TChartSeries *,int,AnsiString &)' to 'TSeriesOnGetMarkText'


Any ideas what the problem could be?

Re: TChartSeries OnGetMarkText causing compiler error

Posted: Fri Dec 17, 2010 3:22 pm
by yeray
Hi Mary,

Try changing this part of the event signature:

Code: Select all

AnsiString &MarkText
for this:

Code: Select all

UnicodeString &MarkText