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?
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With