看了这个例子Inno Setup: Function to select a component后,我为我的代码添加了另一个选项,但是我正在尝试做什么(我不知道是否可行)是如果在组件部分中选项尚未标记,我不希望它出现在 Page1.Add('help'); 或 Page1.Add('readme \ de');
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Types]
Name: full; Description: Full installation
Name: compact; Description: Compact installation
Name: custom; Description: Custom installation; Flags: iscustom
[Components]
Name: program; Description: Program Files; Types: full compact custom; Flags: fixed
Name: help; Description: Help File; Types: full
Name: readme; Description: Readme File; Types: full
Name: readme\en; Description: English; Flags: exclusive
Name: readme\de; Description: German; Flags: exclusive
[Code]
var
Page1: TInputOptionWizardPage;
Procedure BackupCheckCreate();
var
StaticText: TNewStaticText;
begin
Page1 := CreateInputOptionPage(wpReady, 'Optional Actions Test',
'Which actions should be performed?',
'Please select all optional actions you want to be performed, then click Next.', False, False);
Page1.Add('help');
Page1.Add('readme\de');
Page1.Values[0] := False;
Page1.Values[1] := False;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := (PageID = Page1.ID) and (not IsComponentSelected('help') and not IsComponentSelected('readme\de'));
end;
procedure InitializeWizard();
begin
BackupCheckCreate();
end;
答案 0 :(得分:0)
此时无法轻松隐藏TInputOptionWizardPage
或通常任何自定义页面中的项目。因此,通过选定的组件在选项页面上显示某些复选框项目的条件并非易事。所以在深入研究一些hacky方式之前,我会建议你采用另一种方式。
从您正在创建的页面标题看起来您需要[Tasks]
部分。本部分允许您创建其他任务复选框,其中包含与所选组件的简单绑定。检查此示例:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Types]
Name: full; Description: Full installation
Name: compact; Description: Compact installation
Name: custom; Description: Custom installation; Flags: iscustom
[Components]
Name: main; Description: "Program Files"; Types: full compact custom; Flags: fixed
Name: backup; Description: "Backup DB"; Types: full
Name: restore; Description: "Restore DB"; Types: full
[Tasks]
; if "backup" component is selected, these two tasks appear
Name: backuptask1; Description: "Backup 1"; GroupDescription: "Backup Tasks:"; Components: backup
Name: backuptask2; Description: "Backup 2"; GroupDescription: "Backup Tasks:"; Components: backup
; if "restore" component is selected, these two tasks appear
Name: restoretask1; Description: "Restore 1"; GroupDescription: "Restore Tasks:"; Components: restore
Name: restoretask2; Description: "Restore 2"; GroupDescription: "Restore Tasks:"; Components: restore