【问题标题】:Inno Setup wizard change page after user input用户输入后 Inno Setup 向导更改页面
【发布时间】:2018-02-26 15:33:27
【问题描述】:

我想做一个巫师。当用户选择是时,页面 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:\');

【问题讨论】:

  • 我猜你必须使用CurPageChanged 并检查CurPageID 以查看你所在的页面。然后您可以测试用户所做的值并继续。或者您可能需要使用CurStepChanged 并查找CurStep。我知道其他人对此会有更多的了解。

标签: inno-setup wizard


【解决方案1】:

创建页面时,您可以将页面 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;

如果您要将用户单选的结果缓存到公共变量中,那么您可以使用这个:

    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 的情况下显示它。有意义吗?

【讨论】:

  • 太棒了!谢谢! :-)
猜你喜欢
  • 2013-10-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多