阻止自动继续安装到“完成”页面,并允许返回“安装”页面以查看Inno Setup中的结果

问题描述

此问题是Is it possible to display the install actions in a list in Inno Setup?

的后续内容

我不知道此请求的结果,但是是否可以像其他安装程序一样实现 Back / Next 按钮?我知道它们仅在向导可见时才起作用。我喜欢这样的想法,用户有机会在继续之前滚动文件列表。

Installer Buttons

就像我说的那样,我不知道添加这种功能所涉及的复杂性。 返回对我来说并不重要。但是,在适当的时间使 Next 可见(以及 Cancel )并启用是很好的。

解决方法

您可以在安装页面之后添加自定义页面,并在其被激活时将所有安装页面内容移至其中:

var
  AfterInstallPage: TWizardPage;

procedure InitializeWizard();
begin
  AfterInstallPage :=
    CreateCustomPage(wpInstalling,'Installation done','Installation has completed');
  // ...
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if (CurPageID = AfterInstallPage.ID) and
     // Prevent re-adding "Done" to the ProgressListBox when revisiting the page
     (ProgressListBox.Parent <> AfterInstallPage.Surface) then
  begin
    WizardForm.ProgressGauge.Parent := AfterInstallPage.Surface;
    // prevent reanimating the progress
    WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max - 1;
    WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max;

    ProgressListBox.Parent := AfterInstallPage.Surface;
    WizardForm.StatusLabel.Parent := AfterInstallPage.Surface;
    WizardForm.StatusLabel.Caption := 'Done.';
    AddProgress('Done');
  end;
end;

enter image description here

enter image description here