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 2592

Summary: TChart.Canvas throws BeginScene error
Product: FireMonkey TeeChart Reporter: Reini <reini>
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED WONTFIX    
Severity: major CC: yeray
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version: RAD 11 Alexandria
Attachments: Sample application to show BeginScene exception

Description Reini 2023-03-01 03:32:11 EST
Created attachment 1037 [details]
Sample application to show BeginScene exception

This bug is also reported to Embarcadero under:
https://quality.embarcadero.com/browse/RSP-40271
It should be solved in Delphi release 11.3 but it isn't.
It is reproducable with TChart Lite v2021.32.210722
The problem lies in TChart.Canvas that does not call BeginScene. Please build the attached application and notice the exception (under both Delphi 11.2 and Delphi 11.3). The error did not occur when compiled with Delphi 10.4
In the sample application, after pressing the button names "default", the application will try to draw a circle on the canvas of the TChart. Then the error occurs
Comment 1 yeray alonso 2023-03-13 13:26:20 EDT
We won't add `BeginScene`/`EndScene` in all our `TTeeCanvas3D` primitives. It wouldn't be a good design.

So I'd suggest to do it yourself as you did in the comments. Just note you need to use `ReferenceCanvas`:

  EqChart.Canvas.ReferenceCanvas.BeginScene;
  // Do your custom drawing here
  EqChart.Canvas.ReferenceCanvas.EndScene;

Also, I'd suggest you to do the custom drawings at the `OnAfterDraw` event instead of at the button `OnClick`.