Inno Setup: add button action to go to next page

In the Inno Setup installer I need a separate custom button to simulate the next button click behavior, is their a function that I can apply to the custom button's OnClick handler for that?

+3


source to share


1 answer


You can trigger the next button OnClick

event manually, for example, this way (the only parameter here is Sender

, which is usually the object that raised the event, but in the original next button's click event handler this this parameter is ignored, so pass an empty object nil

):

WizardForm.NextButton.OnClick(nil);

      



So the rest is creating your own button and calling the code as shown above to simulate the next button click, like this:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
procedure MyNextButtonClick(Sender: TObject);
begin
  WizardForm.NextButton.OnClick(nil);
end;

procedure InitializeWizard;
var
  MyNextButton: TNewButton;
begin
  MyNextButton := TNewButton.Create(WizardForm);
  MyNextButton.Parent := WizardForm;
  MyNextButton.Left := 10;
  MyNextButton.Top := WizardForm.NextButton.Top;
  MyNextButton.Caption := 'Click me!';
  MyNextButton.OnClick := @MyNextButtonClick;
end;

      

+6


source







All Articles