SaveToStream - Non TChart Components stored, too ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

SaveToStream - Non TChart Components stored, too ?

Post by moelski » Tue Jul 03, 2007 7:34 am

Hi !

Have a look at the following picture:
Image

As you can see there is a Tchart called MainChart. And we place a WPTools WPRichTextLabel on the TChart compoment. We want to view some special information with it.

In some cases we got Exceptions like "EClassNotFound : Class TWPRichTextLabel not found".
I have to say that for now the RichTextLabel isn´t used in any way!

Is it possible that TChart tries to save the WPRichTextLabel as well ?

We got trouble in the methode:

Code: Select all

Procedure LoadChartFromStreamCheck( Var AChart:TCustomChart;
                                    AStream:TStream;
                                    ACheckError:TProcTeeCheckError=nil;
                                    TryReadData:Boolean=False);
It was this line that produces the error:
" Reader.ReadRootComponent(AChart);"

If we delete the WPRichTextLabel all works fine. And keep in mind. The WPRichTextLabel is unused! It is only placed on top of the TChart.

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Thu Jul 05, 2007 5:56 am

Hi Support,

I know you have a lot of work with helping here. But could you please give me a solution / hint for this issue?
It´s really important to us.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jul 05, 2007 7:28 am

Hi Dominik,

I'm afraid this is not possible using TeeChart saving methods. Maybe you could try creating your own object saving methods where it's saved which objects are in your form and it's hierarchy. Maybe even VCL provides methods for that.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Thu Jul 05, 2007 7:36 am

hi Narcís,
I'm afraid this is not possible using TeeChart saving methods.
Well that´s exactly what we know.

Maybe I have to ask in another way ...
How is it possible that TChart ignores such components? That´s the key problem. We don´t want to save the RichEdit with the TChart Methods.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Jul 06, 2007 5:47 pm

Hi.

One dirty solution might be to:
a) Make a list of all components with Parent property equal to Chart1.
b) Prior to using any of chart saving methods, set the component(s) Parent to nil (or something else than Chart1). This should make all these components "invisible" to chart saving methods i.e. you'll be only saving chart and it's properties.
c) After loading "clean" chart, reconnect all components from (a) back to Chart1 by setting their Parent property.

Another solution might be to manually register your component class prior to using LoadChartFromFile (or LoadChartFromStream) routine. Something like this:

Code: Select all

RegisterClass(TWPRichTextLabel);
LoadChartFromFile('c:\temp\test.tee');
I haven't tested this but in theory it should work fine.
Marjan Slatinek,
http://www.steema.com

Post Reply