Inno Setup: Access to custom control from OnClick event of another control

霸气de小男生 提交于 2020-07-19 18:13:01

问题


I have next code for Inno Setup:

procedure CheckBoxClick(Sender: TObject);
begin
  { How to make BrowseButton visible from here? }
end;

procedure CreateTheWizardPage;
var
  Page: TWizardPage;
  BrowseButton, FormButton: TNewButton;
  CheckBox: TNewCheckBox;
  Memo: TNewMemo;
begin
  Page := PageFromID(wpReady);      
  BrowseButton := TNewButton.Create(Page);
  CheckBox := TNewCheckBox.Create(Page); 
  CheckBox.OnClick := @CheckBoxClick;
end;

I'm wondering how can I access custom controllers on the wizard page from handler procedure for one of them?


回答1:


You have to make the BrowseButton variable global and define it before the event handler:

var
  BrowseButton: TButton;

procedure CheckBoxClick(Sender: TObject);
begin
  { Now you can use the BrowseButton here }
end;

procedure CreateTheWizardPage;
var
  Page: TWizardPage;
  FormButton: TNewButton;
  CheckBox: TNewCheckBox;
  Memo: TNewMemo;
begin
  Page := PageFromID(wpReady);      
  BrowseButton := TNewButton.Create(Page);
  CheckBox := TNewCheckBox.Create(Page); 
  CheckBox.OnClick := @CheckBoxClick;
end;

Related question: Reading values from custom Inno Setup wizard pages without using global variables



来源:https://stackoverflow.com/questions/36839988/inno-setup-access-to-custom-control-from-onclick-event-of-another-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!