3

是否可以从TInputQueryWizardPage输入页面(使用CreateInputQueryPage函数创建的页面)有条件地禁用或隐藏编辑框?

我有 4 个编辑框,我需要根据上一个向导页面的输入禁用/隐藏最后两个。我该怎么做 ?

4

1 回答 1

5

您可以通过TInputQueryWizardPage.Editsindexed 属性访问它们:

[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;
于 2012-10-12T14:17:23.487 回答