Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: Add button action for skipping to next page

Tags:

inno-setup

In an Inno Setup installer, I need a separate custom button to mimic the behavior of clicking the next button, is their a function I can apply to the OnClick handler of the custom button to do this?

like image 503
jhamburg Avatar asked Mar 19 '23 07:03

jhamburg


1 Answers

You can trigger the next button's OnClick event manually for instance this way (the only parameter here is the Sender, which is usually the object which triggered the event, but in the original next button click event handler is this parameter ignored, so let's pass an empty, nil object there):

WizardForm.NextButton.OnClick(nil);

So the rest is about creating your own button and calling a code like above to mimic the next button click, for example:

[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;
like image 123
TLama Avatar answered Apr 27 '23 14:04

TLama