Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 121

Summary: [TV52011361] Only happens in BCB (all versions) I just cannot get custom levels t...
Product: VCL TeeChart Reporter: narcís calvet <narcis>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED DUPLICATE    
Severity: major CC: david
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description narcís calvet 2013-11-20 09:58:49 EST
Only happens in BCB (all versions)
I just cannot get custom levels to work in contour series in the vcl. I've looked at the sample code in the demo. In fact the demo exe throws the same access errror exception. The workaround given in the forum for the .NET version ( drawing the contours with autolevels and then re-drawing with custom levels ) doesn't work in VCL. I'm trying this with the simplest possible testbed- a form with a single chart and random data fill. 
Part of the problem may be that I cannot change the boolean value of autolevels at runtime - the instruction is ignored! ( verified in the debugger ). I can set custom levels at design time but this is obviously of no use. A further clue .. I can READ the uptovalue's without an access error but cannot write to them.
Here's my code. I'm using TeeChart 7.05 for Builder 6. I get an access error on read at the line containing Items[0]. 
The stack shows the error to be in Repaint. I'm running winxp pro with 2G of ram but the error is present on computers with different processor/ram configurations. 
If I run your Tee7New.exe in the Examples folder of the distribution and go to "all features/chart styles/extended/contour/custom levels", I get the same access error. I get similar errors in the "smooth segments" example. Again, these errors occur on various machines. 

//--------------------------------------------------------------------------- 
void __fastcall TForm1::AddCustomLevels() 
{ 
  Series1->NumLevels = 10; 
  Series1->CreateAutoLevels(); 
  Series1->Levels->Items[0]->UpToValue = -1.0; 
  Series1->Levels->Items[1]->UpToValue = -0.8; 
  Series1->Levels->Items[2]->UpToValue = -0.6; 
  Series1->Levels->Items[3]->UpToValue = -0.4; 
  Series1->Levels->Items[4]->UpToValue = -0.2; 
  Series1->Levels->Items[5]->UpToValue = 0.0; 
  Series1->Levels->Items[6]->UpToValue = 0.2; 
  Series1->Levels->Items[7]->UpToValue = 0.4; 
  Series1->Levels->Items[8]->UpToValue = 0.6; 
  Series1->Levels->Items[9]->UpToValue = 0.8; 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::FormCreate(TObject *Sender) 
{ 
  Series1->FillSampleValues(20); 
  AddCustomLevels(); 
} 
//--------------------------------------------------------------------------- 
void __fastcall TForm1::CheckBox1Click(TObject *Sender) 
{ 
  Series1->AutomaticLevels = !CheckBox1->Checked; 
  if (!Series1->AutomaticLevels) AddCustomLevels(); 
}
Find attached an example reproducing this.
****
Added two examples at RADXE.zip because the old one was with BCB6:
- Working Delphi XE (D15) example
- Not working B++Builder XE (BCB15) example. It does the same than the delphi example, but it crashes (Access Violation) if you call AddCustomLevels at OnCreate. And if you comment it, you'll how the checkbox doesn't work as one wound expect because the AutomaticLevels property isn't updated. [created:2006-04-10T15:22:42.000+01:00 reported by:narcis@steema.com reported in version:7.06 (TeeChart VCL)]
Comment 1 david berneda 2013-12-19 10:53:54 EST
The problem resides in "#pragma align" metadata added by dcc32 compiled to TeeSurfa.hpp auto-generated C++ header file.

For some reason, TContourSeries C++ class definition does not seem to match the same code alignment than Delphi dcc32.
Comment 2 david berneda 2013-12-19 13:10:02 EST

*** This bug has been marked as a duplicate of bug 324 ***