Page 1 of 1

Print Preview 5.11 problem

PostPosted: January 25th, 2009, 9:48 pm
by array81
Hi, I have installed with success last version of Print Preview on my Delphi 2006. When I try to compile "General Demo" I have a problem. You can see it on image.
The problem is on line 5745 of Preview.pass file.

I have also try to make a new sample application with a TPrintPreview and a TThumbnailPreview but I have the some error.

Can you help me.

Re: Print Preview 5.11 problem

PostPosted: January 26th, 2009, 11:54 am
by Kambiz
Have you installed the latest updates of your Delphi? Seems on Delphi 2006, Item.Index of the virtual TreeView returns the wrong number.

Re: Print Preview 5.11 problem

PostPosted: February 18th, 2009, 9:14 am
by markbolten
Hi,

Kambiz wrote:Have you installed the latest updates of your Delphi? Seems on Delphi 2006, Item.Index of the virtual TreeView returns the wrong number.


i have the same problem. I use version 5.12 and Delphi 7

markbolten

Re: Print Preview 5.11 problem

PostPosted: February 20th, 2009, 2:27 pm
by Kambiz
It's good that the bug occurs on Delphi 7 too because it's easier for me to track it.

I'll check it out.

Re: Print Preview 5.11 problem

PostPosted: February 23rd, 2009, 3:12 pm
by Kambiz
I couldn't regenerate the problem. :(

Anyway, I guess the problem is inside the Thumbnail drawing routine and because of that I checked range of Item.Index to prevent exception (get v5.13). I hope this fixes the problem.

Re: Print Preview 5.11 problem

PostPosted: February 25th, 2009, 3:42 pm
by markbolten
Kambiz wrote:I couldn't regenerate the problem. :(

Anyway, I guess the problem is inside the Thumbnail drawing routine and because of that I checked range of Item.Index to prevent exception (get v5.13). I hope this fixes the problem.


Hi,
the problem is still available!
Now i get a EAcessViolation error (see Image)

Error Message in Delphi7
delphiarea1.png (8.47 KiB) Viewed 1849 times


or
Error if i execute in Windows XP
delphiarea.png (47.09 KiB) Viewed 1851 times

Re: Print Preview 5.11 problem

PostPosted: February 26th, 2009, 1:39 am
by Kambiz
I could see the exception.

Search for the following line in Preview.Pas (line #7564)

Code: Select all
  if Stage <> cdPrePaint then Exit;

and replace it with this one

Code: Select all
  if (Stage <> cdPrePaint) or (Item = nil) or (Item.Index < 0) or (Item.Index >= Items.Count) then Exit;

Actually the Item should never be nil or having junk index. It is apparently because of a bug in ComCtrl 5 of XP.

Re: Print Preview 5.11 problem

PostPosted: February 26th, 2009, 8:25 am
by markbolten
The bug is fixed.

Thanks