根据 Inno Setup 中的编辑框更改更新控件

Update controls based on edit box change in Inno Setup

如何捕获文本框值的变化?

我正在研究如何使用 OnChange 事件函数,但我不知道如何使用它。

[Code]
var
  Page: TInputQueryWizardPage;

procedure InitializeWizard();
begin
  Page := CreateInputQueryPage(wpWelcome,
    'Personal Information', 'Who are you?',
    'Please specify your name and the company for whom you work, then click Next.');

  Page.Add('Server:', False);
  Page.Add('NAME:', False);
  Page.Add('LOCATION:', False);

  Page.Values[0] := ('test0');
  Page.Values[1] := ('test1');
  Page.Values[2] :=  ('string')+Page.Values[0]+('string')+Page.Values[1];
end;

像这样处理 OnChange 事件:

var
  Page: TInputQueryWizardPage;

procedure EditChange(Sender: TObject);
begin
  Page.Values[2] := 'string' + Page.Values[0] + 'string' + Page.Values[1];
end;

procedure InitializeWizard();
begin
  Page := CreateInputQueryPage(...);

  Page.Add('Server:', False);
  Page.Add('NAME:', False);
  Page.Add('LOCATION:', False);

  Page.Values[0] := 'test0';
  Page.Values[1] := 'test1';

  Page.Edits[0].OnChange := @EditChange;
  Page.Edits[1].OnChange := @EditChange;
  { Reflect the initial values }
  EditChange(nil);
end;

请注意,Edit[2] 可以由用户更改,因此您可能希望将其设置为只读。

  Page.Edits[2].ReadOnly := True;
  Page.Edits[2].Color := clBtnFace;

或者您实际上可能想使用 TLabel