1

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?

Martin Prikryl
  • 167,268
  • 50
  • 405
  • 846
Alexander Smith
  • 359
  • 2
  • 12

1 Answers1

2

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

Martin Prikryl
  • 167,268
  • 50
  • 405
  • 846