3

My installer is very simple, it basically is:

  1. Welcome Page
  2. Progress Page
  3. Final Page

The Welcome and Final pages are standard (just one button). At the Progress page I'm installing a bunch of other programs silently.

The actual script is installing each program inside the `[Run] section.
The problem is that the bar reaches 100% and then stays there.
I'm only able to change the message text.

What I would like to achieve is to show the progress using Pascal Script (as it may allow me to have more flexibility), something like:

procedure InitializeWizard;
begin
  ProgressPage.SetProgress(1, 100);
  exec(.......)
  ProgressPage.SetProgress(15, 100);
  exec(.......)
  ProgressPage.SetProgress(40, 100);
  ...
  ...
end;

That way I can show a more accurate progress bar. This is what I have (simulating installation. Taken from an example):

[Code]

var
  ProgressPage: TOutputProgressWizardPage;

procedure InitializeWizard;
begin
  ProgressPage := CreateOutputProgressPage('My App','');
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  I: Integer;
begin
  if CurPageID = wpWelcome then begin
    ProgressPage.SetText('Starting installation...', '');
    ProgressPage.SetProgress(0, 0);
    ProgressPage.Show;
    try
      for I := 0 to 10 do begin
        ProgressPage.SetProgress(I, 10);
        Sleep(100);
      end;
    finally
      ProgressPage.Hide;
    end;
  end else
    Result := True;
end;

The problem is that when I build the installer it doesn't show the Welcome page (the installer is running, but nothing is shown).

What I'm doing wrong?

Thank you in advance!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
lepe
  • 24,677
  • 9
  • 99
  • 108
  • Ergh, don't do it inside NextButtonClick. CurStepChanged(ssInstall) at the earliest. – Deanna Aug 03 '11 at 08:53
  • 1
    Why not inside NextButtonClick? Its the first time I use PascalScripting in Inno Setup so I may not understand how it should be. – lepe Aug 04 '11 at 01:33
  • Because it can be called 1 or more time, it's also, on most installs, before the point the user has confirmed "yes, install this". – Deanna Aug 04 '11 at 08:17

2 Answers2

5

You can control the real progress bar position in code using WizardForm.ProgressGauge.

Deanna
  • 23,876
  • 7
  • 71
  • 156
  • Can you point me to some example please? I can't find how it is used (only the documentation). – lepe Aug 04 '11 at 01:29
  • No example, but the Object reference int he help shows the properties you need to access. They can be called from the Before/AfterInstall entries of the [Run] entries. – Deanna Aug 04 '11 at 08:18
  • I guess using WizardForm.ProgressGauge would be more simple and elegant. However, as I have no examples and my installer is working just fine (as it is) I can just up-vote your suggestion. I can't set it as correct answer as I can not test it. I hope you understand. – lepe Aug 05 '11 at 03:30
  • 1
    @lepe The example code is in my answer to [How to set the progress bar value in the \[Run\] section of the Inno Setup install script?](http://stackoverflow.com/q/34336466/850848) – Martin Prikryl Jun 21 '16 at 14:49
3

Found it!

I was missing :

  • Result := True; after ProgressPage.Hide;
  • if CurPageID = wpReady (Instead of wpWelcome)

That solved the problem!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
lepe
  • 24,677
  • 9
  • 99
  • 108