在之前的问题中,我询问了如何拥有三个可选组件,用户还可以分别指定每个组件的位置(例如,一个代码部分和两个 HTML Web 应用程序)。@Miral 给了我一个很好的答案,我现在已经实现了:
三个用户定义的位置中的三个组件
我还有一个小的审美问题。我总是CreateInputDirPage
在向导中创建并要求用户提供 , 。问题出现在wpSelectComponents
.
问题:如果未选择组件,如何跳过页面。也就是说,我如何跳过我的自定义页面?
我有一种感觉,它与ShouldSkipPage()
. 但我不知道PageID
我的自定义页面是什么,以及如何测试以查看选择了哪些组件。
函数 ShouldSkipPage(PageID: Integer): 布尔值;
向导调用此事件函数来确定是否应该显示特定页面(由 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;