Page 1 of 1

Creating Meta File Bug

Posted: Mon Jul 07, 2008 10:33 pm
by 9339645
I believe I found a bug with TeeCreateMetaFile.
I have a TTree graphic and I am trying to get the image for a given area.
My bounds are TRec(0,0,2200,600);
I ask for TeeCreateMetaFile(True, 0,0,1100,600) {the first page} and it works great.
I ask for TCreateMetaFile(True, -1100,0,1100,600) {the second page} and the image is correct, but the proportions of the image are off. Width = 2200, height = 600.
I have the source and believe I found the bug in TeeProcs.TeeCreateMetaFile.
It is treating the Rect as a rectangle to calculate the Hight and Width.

result.Width :=Max(1,Rect.Right-Rect.Left);
result.Height:=Max(1,Rect.Bottom-Rect.Top);

Since Rect is a point with left and right being the width and height, I believe it should be the following.

result.Width :=Max(1,Rect.Right);
result.Height:=Max(1,Rect.Bottom);

I tried to test my changes, but when I run your TeeRecompile.exe I get the following error.

TeeChart Installation
VERSION: 7
D2006.Win32 v10 (update 2) (BDS v4 Professional)
EXCEPTION:
File not found
--------------------------------------------
EXCEPTION:
Operation aborted
--------------------------------------------

Could you please get me a fix for this.

Posted: Tue Jul 08, 2008 7:47 am
by narcis
Hi Artimus,

If you are a sourcecode customer, have you tried using v7.12 which is latest version available at the client area?

If the problem still persists there, would you be so kind to arrange a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Wed Jul 09, 2008 3:16 pm
by 9339645
Version 7.12 has the same problem.

I got your TeeRecompile.exe to work with 7.12 and fixed the bug, and now it works.

I used your TeeChartOffice for a simple example. I put a button on the chart which tries to do some custom printing. It gave me more problems than my other project did, but I will let you figure out why all the pages don't print how they should.

If you look at the code for 2 seconds you will see the problem. As far as I can see a TRect is used as start point and then .Right as width and .Bottom as height. In TeeProcs TCustomTeePanel.TeeCreateMetafile it creates the picture width and height as .Right - .Left.
//TeeProcs line 1359
result.Width :=Max(1,Rect.Right-Rect.Left);
result.Height:=Max(1,Rect.Bottom-Rect.Top);
when .Right is already the width. So if your left is not 0 but negative, then it makes the picture width wider than it should be.

Posted: Wed Jul 09, 2008 3:45 pm
by 9339645
I uploaded the example.

It is under the name
Steven Prescott
pressr-AT-inl.gov

Just Replace UnitChartOffice files in the TeeChartOffice example with the ones in the zip.


The software was ordered through the secretary
TARA HAACK
haactj-AT-inel.gov
Alias - Artimus

Posted: Mon Jul 14, 2008 10:12 am
by narcis
Hi Artimus,

Thanks for the information. We could reproduce the issue here in v7 and added it (TV52013245) to the defect list to be investigated for next releases.

Posted: Mon Jul 14, 2008 1:40 pm
by 9339645
Do you currently have an approximate date for the next releases?

Posted: Mon Jul 14, 2008 1:52 pm
by narcis
Hi Artimus,

Since summer 2007 current TeeChart VCL version is v8 so it's most unlikely that any upgrade to v7 is made. We'll need to investigate the issue you posted in v8 and I can't give any estimation date at the moment.