windows-installerinno-setupcontext-sensitive-helphtml-help

Adding a help button to an InnoSetup wizard page


I have a setup script with a custom wizard page to get a choice from the user. It would be nice to have a help button and to supply a small CHM file with the installable so that I can provide a detailed explanation of what the choices are.

Anyone know whether there is an easy way to do this?


Solution

  • See this post for details on how to include a file with the installation package and reference that file before installation has started.

    To add a button to the install wizard, I included the following code in the InitializeWizard event handler.

    procedure CreateHelpButton (ParentForm   : TSetupForm ; 
                                X            : integer ;
                                Y            : integer ;
                                W            : integer ;
                                H            : integer) ;
    
    var
      HelpButton : TNewButton ;
    begin
      HelpButton         := TNewButton.Create (ParentForm) ;
      HelpButton.Left    := X ;
      HelpButton.Top     := Y ;
      HelpButton.Width   := W ;
      HelpButton.Height  := H ;
      HelpButton.Caption := '&Help' ;
      HelpButton.OnClick := @HelpButtonOnClick ;
      HelpButton.Parent  := ParentForm ;
    end;
    
    procedure InitializeWizard () ;
    
    begin
      CreateHelpButton (
        WizardForm, ScaleX (20), WizardForm.CancelButton.Top,
        WizardForm.CancelButton.Width, WizardForm.CancelButton.Height) ;
    end;