Page 1 of 1

Print Preview D5 Installation

PostPosted: February 17th, 2009, 10:21 pm
by Morozov
Print Preview v5.12 can't be installed on Delphi 5: as I understand, because TCustomListView.ItemIndex is absent in Delphi 5.

I had to download and install Print Preview v4.75 from Torry.net; it didn't contain such problem.
Thank you for the useful component!

Re: Print Preview D5 Installation

PostPosted: February 18th, 2009, 12:59 am
by Kambiz
Sorry for this inconvenience. Since I lost my old hard disk, I don't have older versions of Delphi to check the components against them.

To use version 5.12 in Delphi 5, add the two following methods to the Preview.pas unit:

Code: Select all
function TThumbnailPreview.GetItemIndex: Integer;
begin
  Result := -1;
  if inherited Selected <> nil then
    Result := inherited Selected.Index;
end;

procedure TThumbnailPreview.SetItemIndex(Value: Integer);
begin
  if Value >= 0 then
    Items[Value].Selected := True
  else if inherited Selected <> nil then
    inherited Selected.Selected := False;
end;

then, add these lines to the private section of the TThumbnailPreview class:

Code: Select all
function GetItemIndex: Integer;
procedure SetItemIndex(Value: Integer);

And, add the following line in the public section of that class:

Code: Select all
property ItemIndex: Integer read GetItemIndex write SetItemIndex;

Thanks for informing me about this problem.

Re: Print Preview D5 Installation

PostPosted: February 18th, 2009, 12:10 pm
by Morozov
Thank you for the fast reply. Other problems with the installation of Print Preview on Delphi 5:

TCustomListView.IsCustomDrawn is absent in D5, so there is no need to "override" it (this directive must be removed);
TCustomListView.DeleteSelected is absent in D5, so there is no need to "override" it (the directive must be removed);

TCustomListView.ClearSelection is absent in D5 (error in TThumbnailPreview.SetSelectedPages);
TCustomListView.DeleteSelected causes error in TThumbnailPreview.DeleteSelected.

I have tried to "fix" these methods in the text of preview.pas, compiled and installed the component, but then I have received the unpleasant surprise: the TThumbnailPreview doesn't draw thumbnails - only "transparent" rectangles instead of them (see picture).


In version 4.75 this worked OK.

Windows 2000 SP4, Delphi 5.1.

Re: Print Preview D5 Installation

PostPosted: February 20th, 2009, 2:24 pm
by Kambiz
Thank you very much for the information.

I guess I have to obtain older versions of Delphi and check the components.

I'll post the result right here.

Re: Print Preview D5 Installation

PostPosted: February 20th, 2009, 3:02 pm
by Kambiz
It was quite easy to figure out the problem.

Please check out the attachment, hope that it works.

Re: Print Preview D5 Installation

PostPosted: February 21st, 2009, 9:43 pm
by Morozov
Thank you, the problem with installation on Delphi 5 is SOLVED. (I'm not a "admirer" of D5, but my customer wants the program made on this version of Delphi. Thank you very much for your extremely useful component.)

Re: Print Preview D5 Installation

PostPosted: February 22nd, 2009, 12:12 am
by Kambiz
Thanks to you for your help and the valuable information.