Search code examples
inno-setup

InfoBeforeFile page before License page in Inno Setup


By default, the page showing InfoBeforeFile file is shown after the license page. From reading the documentation I should be able to re-arrange when these pages are displayed but I don't see how the ordered is structured in Inno setup scripts or the default.isl. This is all under the [Setup] section.

I am simply trying to move the InfoBeforeFile page to be displayed before displaying the license page.

Any help or direction would be appreciated.


Solution

  • After review of the two setup help and documentation, I've found the solution.

    Summary: Basically, what this does is clone the page of Information Page and uses the language variables from that page (WizardInfoBefore) and when the page is created with CreateOutputMsgMemoPage it is set as a 'Welcome Page' with the first parameter of wpWelcome.

    1. You must a define, a welcome page text

      #define WelcomeFile 'welcome.rtf'
      
    2. Define your normal license file under the [Setup] section:

      LicenseFile=gnu.rtf
      
    3. Include the following line in [Files] section:

      Source: "{#WelcomeFile}"; Flags: dontcopy
      
    4. Include the following lines in the [Code] section:

      [Code]
      var
        WelcomePage: TOutputMsgMemoWizardPage;
      
      procedure InitializeWizard();
      var
        WelcomeFileName: string;
        WelcomeFilePath: string;
      begin
        { Create welcome page, with the same labels as the information page }
        WelcomePage :=
          CreateOutputMsgMemoPage(
            wpWelcome, SetupMessage(msgWizardInfoBefore), SetupMessage(msgInfoBeforeLabel),
            SetupMessage(msgInfoBeforeClickLabel), '');
      
        { Load welcome page }
        WelcomeFileName := '{#WelcomeFile}';
        ExtractTemporaryFile(WelcomeFileName);
        WelcomeFilePath := ExpandConstant('{tmp}\' + WelcomeFileName);
        WelcomePage.RichEditViewer.Lines.LoadFromFile(WelcomeFilePath);
        DeleteFile(WelcomeFilePath);
      end;
      

    Output: