Inno Setup 向导在用户输入后更改页面

Inno Setup wizard change page after user input

我想做一个精灵。当用户选择是时,页面 x 应该跟随。当用户选择否时,页面 y 应该跟随。目前它只适用于静态页面,所以没关系,用户选择的内容始终是相同的页面......我该如何改变呢?请问有人有什么想法吗?

摘录如下:

ExistPage := CreateInputOptionPage(OldPage.ID,
  '', '', 'If you choose "Yes" then the package will be installed automatically with this setup',True, False);
// Add items
ExistPage.Add('Yes');
ExistPage.Add('No');
// Set initial values (optional)
ExistPage.SelectedValueIndex := 0;

TexPage := CreateInputDirPage(ExistPage.ID,
'Root installation directory', 'Please select installation directory',
'',
True, 'New Folder');
TexPage.Add('');
// Set initial value (optional)
TexPage.Values[0] := ExpandConstant('C:\');

创建页面时,您可以将页面 ID 存储到变量中:

// InitializeWizard is called when the wizard is about to begin.
// This is where we add any custom pages into the installation process.
// The relevant XXX_CreatePage methods should be defined BEFORE this method.
procedure InitializeWizard();
begin
    // Add the Application Settings page just after the Selected Tasks page
    idAppSettingsPage := AppSettings_CreatePage(wpSelectTasks)
end;

如果您要将用户无线电选择的结果缓存到 public 变量中,那么您可以使用这个:

    function ShouldSkipPage(PageID: Integer): Boolean;
begin
    // We don't want to show the select dir, select program group or application settings
    // pages if we are upgrading.
    if ((PageID = wpSelectDir) or (PageID = idAppSettingsPage) or (PageID = wpSelectProgramGroup)) then
        Result := bIsUpgrading
    else
        Result := False;
    end;

这是我在安装过程中用于有选择地显示页面的设置。我只是不确定您如何检查自定义页面 ID。

我只是在展示技巧。如果您知道现在要显示页面 Y,您可以决定在变量 AA 设置为 1 时显示它。有意义吗?