如何在InnoSetup中更改页面顺序?

use*_*035 3 swap pascal inno-setup

我想在我的设置中将SelectDir页面与Components页面交换.

我找到了一个解决方案,其他页面的内容被分配给当前页面.

Procedure CurPageChanged(CurPageID: Integer);
Begin
  Case CurPageID of
  wpSelectDir:
    begin
      WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
      WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents)
      WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption;
      WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc)
    end;
  wpSelectComponents:
    begin
      WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
      WizardForm.DiskSpaceLabel.Caption:= WzardForm.ComponentsDiskSpaceLabel.Caption;
      WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir)
      WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint
    end;
  end;
End;
Run Code Online (Sandbox Code Playgroud)

使用此方法的问题是仅更改内容而不更改实际页面.消息框和错误消息不受影响.我编写了许多代码来解决这些问题,但我遇到的问题越来越多......

有更好的解决方案吗?我希望你能帮帮我!

编辑:经过实验,我想出了这个:

procedure RedesignWizard;
var
  Page: TWizardPage;
begin
  Page := CreateCustomPage(wpWelcome, 'bla', 'bla');
  WizardForm.ComponentsList.Parent := Page.Surface;
  //Here  I am changing the layout of the pages...
end;

procedure InitializeWizard;
begin
  RedesignWizard;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if (CurPageID = Page.ID) then
  begin
  //perform your actions specific to the Custom page here.
  end;
end;
Run Code Online (Sandbox Code Playgroud)

这样,组件列表出现在SelctDirPage之前,我对这些消息框没有任何问题.

Mir*_*ral 6

绝对没有办法安全地交换任何内置页面的顺序.(通常,人们问的唯一一次是他们试图复制不同安装系统的流程.放松并放手; Inno的工作方式不同,拥抱它而不是与之抗争.)

话虽如此,通过将页面中的一个或另一个重新创建为自定义页面,可以给出交换页面的外观.但是,通过执行此操作,您将丧失与该页面关联的所有内置功能 - 例如.如果你替换组件页面然后你不能使用[Components]部分或参数,如果你替换目录页面,那么你不能使用{app}(甚至在那些隐式使用它的地方,例如UninstallFilesDir).

如果你愿意花费大量的时间和精力(尤其是测试),那么就可以完成.但结果一切都变得更糟 - 所以通常你最好不要这样做.

  • 此功能是否已添加到最新版本的 INNO 中?我只想显示“选择位置”页面是否正在安装某些组件。否则我不需要显示该页面。但在选择组件之前我无法判断是否需要显示它。 (2认同)