0

I'm trying to get this Martin Prikryl code to work in my Setup: Long descriptions on Inno Setup components

But when I put WizardSizePercent=121 inside the [Setup] section, the code works, but it has some problem that causes the components caption to be overlapped by the ComponentsList.

And I tried to change the code below (The end of the original code) but it was no use. The only thing you can change by doing this is changing the height of the WizardForm.ComponentsList.Height.

Can anyone help me with this?

procedure InitializeWizard();
begin
  SetTimer(0, 0, 50, CreateCallback(@HoverTimerProc));

  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;

  WizardForm.ComponentsList.Height :=
    WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8);
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • See [Inno Setup - how to center an animated gif in resized wizard](https://stackoverflow.com/q/63502238/850848). – Martin Prikryl Jan 25 '22 at 07:17
  • I was able to change it, but when using `CurPageChanged`, the code makes a call every time I switch pages, with that it adds lots and lots of captions on the page. I used the `procedure CurPageChanged(wpWelcome: Integer);` instead of `procedure InitializeWizard();` – faelBrunnoS Jan 25 '22 at 21:46

1 Answers1

0

I managed to solve the problem by adding a boolean variable. The StopCall variable starts with false and if it is false, it executes the code and then sets it to true.

So the next time CurPageChanged is executed, the value will be true and the code will not add a new caption.

var StopCall: Boolean;

procedure CurPageChanged(CurPageID: Integer);
begin
  if StopCall = false then
    begin
      if CurPageID = wpWelcome then
        begin
          SetTimer(0, 0, 50, CreateCallback(@HoverTimerProc));

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

          WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8);
          StopCall := true;
        end;
    end;
end;
  • You should have put only the position assignments to the `CurPageChanged`. The rest should have stayed in the `InitializeWizard`. – Martin Prikryl Jan 26 '22 at 07:03
  • I tried, but I'm still new at it. Then the only way I could solve it was like this. But thank you very much, if it wasn't for your comment, I wouldn't have made it! – faelBrunnoS Jan 26 '22 at 10:41