以前の質問で、ユーザーが各コンポーネントの場所を個別に指定できる (コード部分と 2 つの HTML Web アプリケーションなど) 3 つのオプション コンポーネントを使用する方法を尋ねました。@Miral は、私が今実装したすばらしい答えをくれました:
3 つのユーザー定義の場所にある 3 つのコンポーネント
審美的な問題が少し残っています。私は常に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;