0

How can I modify Inno Setup script from Inno Setup: Enlarge component page only with preview and description to on an separate window (512x400 dimensions).

Like this:

enter image description here

Community
  • 1
  • 1
yaya 070
  • 45
  • 1
  • 6

1 Answers1

2

Building upon my answer to Long descriptions on Inno Setup components. You will need to copy HoverTimerProc and it's supporting functions and global variables.

This answer modifies the HoverComponentChanged and InitializeWizard procedures to support an image window in addition to description labels.

[Files]
...
Source: Main.bmp; Flags: dontcopy
Source: Additional.bmp; Flags: dontcopy
Source: Help.bmp; Flags: dontcopy

[Code]

var
  CompLabel: TLabel;
  CompForm: TSetupForm;
  CompImage: TBitmapImage;
  LoadingImage: Boolean;

procedure HoverComponentChanged(Index: Integer);
var 
  Description: string;
  Image: string;
  ImagePath: string;
begin
  case Index of
    0: begin Description := 'This is the description of Main Files'; Image := 'main.bmp'; end;
    1: begin Description := 'This is the description of Additional Files'; Image := 'additional.bmp'; end;
    2: begin Description := 'This is the description of Help Files'; Image := 'help.bmp'; end;
  else
    Description := 'Move your mouse over a component to see its description.';
  end;
  CompLabel.Caption := Description;

  if Image <> '' then
  begin
    { The ExtractTemporaryFile pumps the message queue, prevent recursion }
    if not LoadingImage then
    begin
      LoadingImage := True;
      try
        ImagePath := ExpandConstant('{tmp}\' + Image);
        if not FileExists(ImagePath) then
        begin
          ExtractTemporaryFile(Image);
        end;
        CompImage.Bitmap.LoadFromFile(ImagePath);
      finally
        LoadingImage := False;
      end;
    end;
    CompForm.Left := WizardForm.Left + WizardForm.Width;
    CompForm.Top := WizardForm.Top;
    CompForm.Visible := True;
  end
    else
  begin
    CompForm.Visible := False;
  end;
end;

procedure InitializeWizard();
var
  HoverTimerCallback: LongWord;
begin
  HoverTimerCallback := WrapTimerProc(@HoverTimerProc, 4);

  SetTimer(0, 0, 50, HoverTimerCallback);

  CompLabel := TLabel.Create(WizardForm);
  CompLabel.Parent := WizardForm.SelectComponentsPage;
  CompLabel.Left := WizardForm.ComponentsList.Left;
  CompLabel.Width := WizardForm.ComponentsList.Width;
  CompLabel.Height := ScaleY(32);
  CompLabel.Top := WizardForm.ComponentsList.Top + WizardForm.ComponentsList.Height - CompLabel.Height;
  CompLabel.AutoSize := False;
  CompLabel.WordWrap := True;

  CompForm := CreateCustomForm;
  CompForm.ClientWidth := 512;
  CompForm.ClientHeight := 400;
  CompImage := TBitmapImage.Create(CompForm);
  CompImage.Parent := CompForm;
  CompImage.Top := 0;
  CompImage.Left := 0;
  CompImage.Width := CompForm.ClientWidth;
  CompImage.Height := CompForm.ClientHeight;

  WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8);
end;

Component preview window

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • @MartinPrikryl, How to display localized images? (eng, spa). My images contain some text. I have to create a new question? – Nico Z Jan 16 '17 at 11:32
  • 1
    @NicoZ One way is to define a "custom message" with a name of the image file. See http://stackoverflow.com/q/31053177/850848 - If you need more details, ask a question. – Martin Prikryl Jan 16 '17 at 11:45
  • @MartinPrikryl, I'm trying to change the color of the description of the ¨Additional Files¨ only. How to change the color only of that? – Nico Z Jan 16 '17 at 15:01
  • @NicoZ That's definitely a new question. – Martin Prikryl Jan 16 '17 at 15:25