element has no parent window

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MHotz
Newbie
Newbie
Posts: 12
Joined: Mon Nov 25, 2013 12:00 am
Contact:

element has no parent window

Post by MHotz » Fri Apr 18, 2014 1:17 pm

Hi!

I am trying to migrate my project from TeeChart Pro 2012 to Tee Chart Pro 2014. But at a specific position I receive the error "element has no parent window". The Code that raises the exception is:

Code: Select all

    MyChart.SaveToMetafileEnh('C:\Temp\Test.emf');
Prior to that I created the Chart with the following statement:

Code: Select all

    MyChart := TChart.Create(nil);
So ok the chart definetly has no owner. But all that works fine with 2012 but not with your latest version. And I cannot assign an owner because I don't have one!

I have the Pro version with source code.

Thanks for your help in advance!

Regards
Markus

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: element has no parent window

Post by Yeray » Tue Apr 22, 2014 8:28 am

Hi Markus,

Take a look at the example attached. It seems to work fine for me here with v2014.10.
testParentEMF.zip
(5.7 KiB) Downloaded 468 times
Could you please give it a try and modify it so we can reproduce the problem here?

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

MHotz
Newbie
Newbie
Posts: 12
Joined: Mon Nov 25, 2013 12:00 am
Contact:

Re: element has no parent window

Post by MHotz » Tue Apr 22, 2014 4:16 pm

Hi Yeray!

Well your right in principal your code works. So I scanned my project deeper and found that it has something to do with that statement:

Code: Select all

MyChart.TeeCreateBitmap;


If I call that method before I call

Code: Select all

MyChart.SaveToMetafileEnh('C:\Temp\Test.emf');


the first call itself fails with "element has no parent window".

So I commented that first call out and now it works! I don't know why I call "TeeCreateBitmap" before but maybe it was needed in a former version of TChart. I hope I won't get an error at a currently unknown and unexpectable position in my code. But for now I am glad!

So thank's for your prompt support. Even if it doesn't solve my problem directly it showed me that I had to make a deeper look in my code.

Regards
Markus

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: element has no parent window

Post by Yeray » Wed Apr 23, 2014 8:08 am

Hi Markus,
MHotz wrote:Well your right in principal your code works. So I scanned my project deeper and found that it has something to do with that statement:

Code: Select all

MyChart.TeeCreateBitmap;


If I call that method before I call

Code: Select all

MyChart.SaveToMetafileEnh('C:\Temp\Test.emf');


the first call itself fails with "element has no parent window".
Strange. I've added the TeeCreateBitmap call before the SaveToMetafileEnh in the project I attached above and I still don't see any error with TeeChart v2014.10. I'm testing it with Delphi 7, what IDE are you running?
MHotz wrote:So I commented that first call out and now it works! I don't know why I call "TeeCreateBitmap" before but maybe it was needed in a former version of TChart. I hope I won't get an error at a currently unknown and unexpectable position in my code. But for now I am glad!

So thank's for your prompt support. Even if it doesn't solve my problem directly it showed me that I had to make a deeper look in my code.
That's good! I'm glad to be helpful!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply