tkrn
tkrn

Reputation: 606

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.

Upvotes: 4

Views: 1763

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202642

You cannot reorder the standard pages.

Your might be able to code a different order by cleverly implementing NextButtonClick, BackButtonClick, CurPageChanged and ShouldSkipPage event functions. But that would be too complicated. You would have to re-implement lot of built-in functionality of Inno Setup.


A way easier is to insert a custom license page or info page in the order you want.

This example adds a custom license page:
How to create two LicenseFile pages in Inno Setup.

Though, adding a custom info page is a lot easier, as it does not have the radio buttons. All you need is to load a file to a page created with CreateOutputMsgMemoPage function.

Upvotes: 4

tkrn
tkrn

Reputation: 606

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:

Upvotes: 3

Related Questions