![]() | Steema Issues DatabaseNote: 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. |
| Summary: | "Control has no parent window" error if the chart has no parent and you call Draw and then TeeCreateBitmap. | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | yeray alonso <yeray> |
| Component: | Export | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | david |
| Priority: | Normal | ||
| Version: | 140220 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| URL: | http://www.teechart.net/support/viewtopic.php?p=65469#p65469 | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | chart without parent can't be drawn and then exported | ||
Note this crashes in TeeChart v8 too One possible fix is the following code, using the chart Owner if Parent is nil.
TeeProcs.pas
function TCustomTeePanelExtended.GetDeviceContext(var WindowHandle: HWnd): HDC;
begin
if Assigned(Parent) then
WindowHandle:=Handle
else
if Assigned(Owner) and (Owner is TWinControl) then
WindowHandle:=TWinControl(Owner).Handle;
result:=GetDC(WindowHandle);
end;
If Owner is nil, it should still work, with WindowHandle=0.
This worked between v2014.10 and v2016.18 (both included) but it was broken again from v2016.19 (commit 86010700). This should be fixed in the latest build March 23 |
Created attachment 132 [details] chart without parent can't be drawn and then exported You can use TeeCreateBitmap to export a chart that has no parent. But if you force a chart Draw before doing so, you get a "Control has no parent window" error. And, in some situations you may need to force a chart repaint before exporting it so everything is at the correct place. Ie using CalcXPos/CalcYPos methods to set some element position. For more details see the thread in the forums.