【发布时间】:2012-12-04 23:37:16
【问题描述】:
在之前的问题中,我询问了如何拥有三个可选组件,用户还可以分别指定每个组件的位置(例如,一个代码部分和两个 HTML Web 应用程序)。 @Miral 给了我一个很好的答案,我现在已经实现了:
three components in three user defined locations
我还有一个小的审美问题。我总是在向导中创建并询问用户CreateInputDirPage。问题出现在wpSelectComponents 之后。
问题:如果未选择组件,我如何跳过页面。也就是说,如何跳过我的自定义页面?
我感觉它与ShouldSkipPage() 有关。但我不知道我的自定义页面的 PageID 是什么,以及如何测试以查看选择了哪些组件。
function ShouldSkipPage(PageID: Integer): Boolean;
向导调用此事件函数来确定是否应该显示特定页面(由 PageID 指定)。如果返回True,则页面将被跳过;如果返回 False,可能会显示页面。
我的脚本附在下面:
[Components]
Name: "Watson"; Description: "Watson Component"; Types: onlywatson full
Name: "Toby"; Description: "Toby Component"; Types: onlytoby full
Name: "Sherlock"; Description: "Sherlock Component"; Types: onlysherlock full
[Code]
var
TobyDirPage: TInputDirWizardPage;
SherlockDirPage: TInputDirWizardPage;
procedure InitializeWizard;
begin
TobyDirPage := CreateInputDirPage(wpSelectComponents,
'Select Location for Toby Web Pages', 'Where should we store the sample Toby application files?',
'The sample Toby stand-alone map application will be saved in the following folder.'#13#10#13#10 +
'To continue, click Next. If you would like to select a different folder, click Browse.',
False, 'New Folder');
{ Add item (with an empty caption) }
TobyDirPage.Add('');
{ Set initial value (optional) }
TobyDirPage.Values[0] := ExpandConstant('c:\wwwroot\Toby');
SherlockDirPage := CreateInputDirPage(wpSelectComponents,
'Select Location for Sherlock Web Pages', 'Where should we store the Sherlock Catalog Search Tool?',
'Sherlock.html and it'#39 + 's associated files will be saved in the following folder.'#13#10#13#10 +
'To continue, click Next. If you would like to select a different folder, click Browse.',
False, 'New Folder');
{ Add item (with an empty caption) }
SherlockDirPage.Add('');
{ Set initial value (optional) }
SherlockDirPage.Values[0] := ExpandConstant('c:\wwwroot\Sherlock');
end;
function GetTobyDir(Param: String): String;
begin
{ Return the selected TobyDir }
Result := TobyDirPage.Values[0];
end;
function GetSherlockDir(Param: String): String;
begin
{ Return the selected TobyDir }
Result := SherlockDirPage.Values[0];
end;
【问题讨论】:
标签: inno-setup