是否可以从TInputQueryWizardPage输入页面(使用CreateInputQueryPage功能创建的页面)有条件地禁用或隐藏编辑框?
我有4个编辑框,我需要根据上一个向导页面的输入禁用/隐藏最后两个。我该怎么办?
答案 0 :(得分:5)
您可以通过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;