Search code examples
installationinno-setuppascalscript

Inno Setup - Display message if "I Do Not Accept" radio button is selected


I am using a variation of How to create two LicenseFile pages in Inno Setup to display a second license page in an Inno Setup-based installer. Unlike that code, I am not selecting a default. So these radio buttons appear, with no selection:

[ ] I accept the agreement
[ ] I do not accept the agreement

If the user selects the second radio -- I do not accept the agreement -- I would like to show a custom message to the user (message window). I do not need it to allow Next> to be clicked still or other workflow. Just show a message when they click do not accept radio.


Solution

  • Handle the OnClick event (despite the naming, it's triggered when the radio button is selected any way):

    procedure License2NotAcceptedRadioClick(Sender: TObject);
    begin
      MsgBox('Hello.', mbInformation, MB_OK);
    end;
    
    procedure InitializeWizard();
    begin
      { ... }
    
      License2NotAcceptedRadio.OnClick := @License2NotAcceptedRadioClick;
    end;
    

    As Bill commented, you should handle silent installations somehow.