3
是否可以有條件地禁用或隱藏TInputQueryWizardPage輸入頁面(使用CreateInputQueryPage函數創建的頁面)的編輯框?如何從TInputQueryWizardPage輸入頁面禁用編輯框?
我有4個編輯框,我需要根據上一個嚮導頁面的輸入禁用/隱藏最後兩個。我該怎麼做 ?
是否可以有條件地禁用或隱藏TInputQueryWizardPage輸入頁面(使用CreateInputQueryPage函數創建的頁面)的編輯框?如何從TInputQueryWizardPage輸入頁面禁用編輯框?
我有4個編輯框,我需要根據上一個嚮導頁面的輸入禁用/隱藏最後兩個。我該怎麼做 ?
您可以通過TInputQueryWizardPage.Edits
索引屬性訪問它們:
[Code]
var
FirstEditIndex: Integer;
SecondEditIndex: Integer;
InputPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
InputPage := CreateInputQueryPage(wpWelcome, 'Caption', 'Dscription', 'SubCaption');
// the Add method returns the Index of the just added edit box, and
// you need to store those indexes to access the edit boxes later on
FirstEditIndex := InputPage.Add('Name:', False);
SecondEditIndex := InputPage.Add('Surname:', False);
// access the edits through the stored indexes; in your case this will
// happen in the other event, so take this script as a showcase
InputPage.Edits[FirstEditIndex].Enabled := False;
InputPage.Edits[SecondEditIndex].Visible := False;
end;