Page 1 of 1

MDI Child & Chart width / height

Posted: Mon Nov 17, 2008 2:47 pm
by 10545590
Hi !

I have a MDI application and the MDI Child is only a form with a chart (Align = clClient).

I create a new MDI Child and change the size of the window (because of the alignment the chart will be resized, too).

Now I call this:

Code: Select all

  SaveChartToFile(TfrChild(frMain.ActiveMDIChild).Chart1,
                  'Test.lov',
                  True,
                  True);
I got a file which looks like this:
object TChart
Left = 0
Top = 0
Width = 426
Height = 286
Title.Text.Strings = (
'TChart')
Align = alClient
TabOrder = 0
end
Now I close the MDI Child and open a new MDI child window. The size is set back to the default size.

Now I load back the TEE File:

Code: Select all

  LoadChartFromFile(TCustomChart(TfrChild(frMain.ActiveMDIChild).Chart1),
                    'Test.lov');
This works, but the size wont be changed to that size which is saved in the Test.lov file.
So what must I do in order to get the correct saved chart size automatically?

I tried to set the AutoSize property to true, but this won´t help.

Any suggestions?

Posted: Wed Nov 19, 2008 7:55 am
by 10545590
Hi Support,

no hint :roll: ?

Posted: Wed Nov 19, 2008 8:09 am
by narcis
Hi moelski,

We need some time to investigate the issue here. We will get back to you ASAP.

Posted: Wed Nov 19, 2008 8:18 am
by 9333771
Hi,

I did have a similar issue.

try the following method:

- create/move the MID child outside of the visible area (left=-5000).
- set a form size > screen size (width=3000)
- disable the chart alClient
- load the chart file.
- read the chart size, and resize the form client area.
- re set the chart alClient
- move back the form to the visible area.

also, you can save the form size in a custrom (perso) file data. and include the chart file inside this one. (then load the form size, then extract the chart data file and load it)
This is the ways I recommend you. So you can add other info in the future.


hope this help,

Posted: Wed Nov 19, 2008 8:21 am
by 10545590
Hi Mariano,

it would also be possible to read the TEE file and get the width / height. And then you set the MDI Width / height.

But I think this is an issue that should be fixed by steema.

Posted: Fri Nov 21, 2008 8:42 am
by 9333771
hi,

yes, you can read by yourself the TEE file, but you may want to not depend too much of the Steema file format.

This is just a workaround. I use this kind of solution to have a feeling of "instant" loading in my app. (to prevent flashing when you reload a lot of chart/mdi at one). Also, I do load other data related to the MDI.

note that an other solution is to create the chart by hand (without a parent, and so not visible), load the file, get the size, then "add it" to the MDI. If you look in that way, search the forum about this. I remember some issue with the .width of charts with no parent.

Posted: Mon Nov 24, 2008 7:58 am
by narcis
Hi moelski,

This is most likely a Delphi issue. We think sames happens with an image set to Align=alClient. As suggested, a solution could be loading the tee file.

An alternative would be changing Align to alNone before saving the chart. Maybe then when loading it makes the chart bigger than child's form. Then you can make the form to be the size of the chart and then set the chart back to Align=alClient.