Search code examples
inno-setupskip

Why does the ShouldSkipPage procedure work for the WelcomePage?


In Inno Setup Help the next is written: enter image description here

I write this code:

  [Setup]
    AppName=My Program
    AppVersion=1.5
    DefaultDirName={pf}\My Program
    DefaultGroupName=My Program
    UninstallDisplayIcon={app}\MyProg.exe
    Compression=lzma2
    SolidCompression=yes
    OutputDir=userdocs:Inno Setup Examples Output

    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"
    Source: "MyProg.chm"; DestDir: "{app}"
    Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme

    [Icons]
    Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

    [code]
    function ShouldSkipPage(PageID: Integer): Boolean;
    begin
     if PageID = 1 then
       Result := True;
    end;

and then I press F7 for Step Into mode and what I see is that ShouldSkipPage is immediately called, PageId is 1, the result is True and as a result the WelcomePage is actually skipped. I've read similar posts about this procedure and that it's called many times etc. but I still don't get it. Looks like Help is wrong. Does anybody know for sure how this procedure works and why it's called for the WelcomePage ignoring the Help info?


Solution

  • Up-to-date documentation does not list wpWelcome:

    function ShouldSkipPage(PageID: Integer): Boolean;

    The wizard calls this event function to determine whether or not a particular page (specified by PageID) should be shown at all. If you return True, the page will be skipped; if you return False, the page may be shown.

    Note: This event function isn't called for the wpPreparing, and wpInstalling pages, nor for pages that Setup has already determined should be skipped (for example, wpSelectComponents in an install containing no components).


    According to version history, this has changed in 5.3.9 (2010-04-10):

    Added new [Setup] section directive: DisableWelcomePage to hide the Welcome wizard page. Doing so is recommended by the Aero wizard guidelines. Additionally, the ShouldSkipPage event function is now also called for wpWelcome.


    And actually, the current version of Inno Setup does not show that page default at all.
    See Welcome page not showing, SelectDir page is showing first instead