检查 Inno Setup 中是否只选择了一个特定组件
Checking if only one specific component is selected in Inno Setup
我需要在组件 selection 页面中仅 selected 时跳过页面。请看下图
[Components]
Name: DBS\TRACE; Types: DBS TBLWOS; Description: DBS Tracing Bodylife Database;
要求是在 "DBS Tracing Bodylife Database" 选项(图中突出显示)单独 selected 并单击“下一步”按钮时跳过页面。如果我 select 只有那个选项,我可以使用下面的代码成功跳过该页面。
if PageID = PageToBeSkipped.ID then begin
Result := not (IsComponentSelected('not DBS\TRACE'));
end;
但是如果我 select 任何其他附加组件以及此页面中的 "DBS Tracing Bodylife Database" 将近 20 个,则不应跳过该页面。如果任何其他组件也被 selected,上面的代码将跳过该页面。
我该如何处理?
提前致谢!
要测试是否选择了任何组件(一个特定组件除外),您可以使用 WizardSelectedComponents
function(其中 returns 一个 comma-separated 所选组件列表)。
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = PageToBeSkipped.ID then
begin
Result := (CompareText(WizardSelectedComponents(False), 'DBS,DBS\TRACE') = 0);
end;
end;
请注意 WizardSelectedComponents
returns 甚至 "partially" 选定的组件组。
我需要在组件 selection 页面中仅 selected 时跳过页面。请看下图
[Components]
Name: DBS\TRACE; Types: DBS TBLWOS; Description: DBS Tracing Bodylife Database;
要求是在 "DBS Tracing Bodylife Database" 选项(图中突出显示)单独 selected 并单击“下一步”按钮时跳过页面。如果我 select 只有那个选项,我可以使用下面的代码成功跳过该页面。
if PageID = PageToBeSkipped.ID then begin
Result := not (IsComponentSelected('not DBS\TRACE'));
end;
但是如果我 select 任何其他附加组件以及此页面中的 "DBS Tracing Bodylife Database" 将近 20 个,则不应跳过该页面。如果任何其他组件也被 selected,上面的代码将跳过该页面。
我该如何处理?
提前致谢!
要测试是否选择了任何组件(一个特定组件除外),您可以使用 WizardSelectedComponents
function(其中 returns 一个 comma-separated 所选组件列表)。
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = PageToBeSkipped.ID then
begin
Result := (CompareText(WizardSelectedComponents(False), 'DBS,DBS\TRACE') = 0);
end;
end;
请注意 WizardSelectedComponents
returns 甚至 "partially" 选定的组件组。