Page 1 of 1

element has no parent window

Posted: Fri Apr 18, 2014 1:17 pm
by 16567896
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

Re: element has no parent window

Posted: Tue Apr 22, 2014 8:28 am
by yeray
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 474 times
Could you please give it a try and modify it so we can reproduce the problem here?

Thanks in advance.

Re: element has no parent window

Posted: Tue Apr 22, 2014 4:16 pm
by 16567896
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

Re: element has no parent window

Posted: Wed Apr 23, 2014 8:08 am
by yeray
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!