我看到这个代码几乎可以满足我的需要。 它在您选择组件后创建一个页面,我可以在其中选择是否" help"在该文件夹中是"输入"。
我真正需要的是,如果你选择" help"转到页面#1创建不会选择另一个页面#2创建。
如果所选组件是" help"转到第1页 如果所选组件不是" help"转到第2页
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
OutputDir=userdocs:Inno Setup Examples Output
[Components]
Name: "help"; Description: "Help File";
[Code]
var
CustomPageID: Integer;
procedure InitializeWizard;
var
CustomPage: TInputDirWizardPage;
begin
CustomPage := CreateInputDirPage(wpSelectComponents, 'Caption',
'Description', 'SubCaption', False, 'NewFolderName');
CustomPage.Add('Input');
// store your custom page ID to further use in the ShouldSkipPage event
CustomPageID := CustomPage.ID;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
// initialize result to not skip any page (not necessary, but safer)
Result := False;
// if the page that is asked to be skipped is your custom page, then...
if PageID = CustomPageID then
// if the component is not selected, skip the page
Result := not IsComponentSelected('help');
end;