Rajendra Dewani
Rajendra Dewani

Reputation: 176

Installation steps on left side - Inno Setup

Inno Setup - I want to create an installer similar to the screenshot.

The installer should highlight the current step on the left side.

How to achieve the same?

InnoSetup

Upvotes: 3

Views: 237

Answers (1)

Slappy
Slappy

Reputation: 5472

@Bill_Stewart is correct, vanilla Inno Setup does not offer such complex functionality.

However it is possible to do that using Graphical Installer which is a 3rd party extension for Inno Setup (see www.graphical-installer.com for more info).

Welcome License Directory

The implemented functionality (about 150 lines in Pascal):

; This identifier is used for compiling script as Graphical Installer powered installer. Comment it out for regular compiling.
#define GRAPHICAL_INSTALLER_PROJECT

#ifdef GRAPHICAL_INSTALLER_PROJECT
    ; File with setting for graphical interface
    #include "script.graphics.iss"
#else
    ; Default UI file
    #define public GraphicalInstallerUI ""
#endif

[Setup]
AppName=InnoSetupProject
AppVersion=1.5
LicenseFile=readme.txt
DefaultDirName={autoappdata}\InnoSetupProject
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=Output
OutputBaseFilename=InnoSetupProject
PrivilegesRequired=lowest
; Directive "WizardSmallImageBackColor" was modified for purposes of Graphical Installer.
WizardSmallImageBackColor={#GraphicalInstallerUI}
DisableWelcomePage=no

[Code]

type
    TInnoPageStep = record
        PageID: Integer;
        Caption: String;
        Index: Integer;
        IsActive: Boolean;
    end;

var
    AllPagesList: array of TInnoPageStep;
    AllPagesCount: Integer;
    AllPagesCheckListBox: TNewCheckListBox;

    I: Integer;

procedure SetPagesCount(pages: Integer);
begin
    AllPagesCount := 0;
    SetLength(AllPagesList, pages);
end;

procedure AddPage(pageID: Integer; caption: String);
var
    page: TInnoPageStep;
begin
    page.Caption := caption;
    page.PageID := pageID;
    page.Index := AllPagesCount + 1;

    AllPagesList[AllPagesCount] := page;
    AllPagesCount := AllPagesCount + 1;
end;

procedure CreatePagesListBox();
begin
  AllPagesCheckListBox := TNewCheckListBox.Create(WizardForm);
  AllPagesCheckListBox.Top := ScaleX(160);
  AllPagesCheckListBox.Left := ScaleY(20);
  AllPagesCheckListBox.Width := 260;
  AllPagesCheckListBox.Height := ScaleY(300);
  AllPagesCheckListBox.BorderStyle := bsNone;
  AllPagesCheckListBox.ParentColor := True;
  AllPagesCheckListBox.MinItemHeight := 30;
  AllPagesCheckListBox.ShowLines := False;
  AllPagesCheckListBox.WantTabs := True;
  AllPagesCheckListBox.Parent := WizardForm;

  for I := 0 to AllPagesCount-1 do
  begin
    AllPagesList[I].Index := AllPagesCheckListBox.AddRadioButton(AllPagesList[I].Caption, '', 0, False, True, nil);
  end;
end;

procedure UpdateActivePage(pageID: Integer);
begin
    for I := 0 to AllPagesCount-1 do
    begin
        if (AllPagesList[I].PageID = pageID) then
            AllPagesList[I].IsActive := True
        else
            AllPagesList[I].IsActive := False;
    end;

    for I := 0 to AllPagesCount-1 do
    begin
        AllPagesCheckListBox.Checked[AllPagesList[I].Index] := AllPagesList[I].IsActive;
        if (AllPagesList[I].IsActive) then
        begin
            AllPagesCheckListBox.ItemFontStyle[AllPagesList[I].Index] := [fsBold];
            AllPagesCheckListBox.ItemFontColor[AllPagesList[I].Index] := clBlack;
        end
        else
        begin
            AllPagesCheckListBox.ItemFontStyle[AllPagesList[I].Index] := [];
            AllPagesCheckListBox.ItemFontColor[AllPagesList[I].Index] := clWhite;
        end;
    end;

    AllPagesCheckListBox.Invalidate;
end;


procedure CurPageChanged(CurPageID: Integer);
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    PageChangedGraphicalInstaller(CurPageID);
    #endif

    UpdateActivePage(CurPageID);
end;

// Next functions are used for proper working of Graphical Installer powered installer
procedure InitializeWizard();
var
    pageIDs: array of Integer;
    pageCaptions: array of String;
begin

    #ifdef GRAPHICAL_INSTALLER_PROJECT
    InitGraphicalInstaller();
    #endif

    // This is a list of all standard pages in Inno Setup.
    pageIDs := [wpWelcome, wpLicense, wpPassword, wpInfoBefore, wpUserInfo, wpSelectDir, wpSelectComponents, wpSelectProgramGroup, wpSelectTasks, wpReady, wpPreparing, wpInstalling, wpInfoAfter, wpFinished];
    pageCaptions := ['wpWelcome', 'wpLicense', 'wpPassword', 'wpInfoBefore', 'wpUserInfo', 'wpSelectDir', 'wpSelectComponents', 'wpSelectProgramGroup', 'wpSelectTasks', 'wpReady', 'wpPreparing', 'wpInstalling', 'wpInfoAfter', 'wpFinished'];

    // The setup will have 5 pages
    SetPagesCount(5);

    // If you are using custom pages you need to add them too
    AddPage(pageIDs[0], pageCaptions[0]);
    AddPage(pageIDs[1], pageCaptions[1]);
    AddPage(pageIDs[5], pageCaptions[5]);
    AddPage(pageIDs[11], pageCaptions[11]);
    AddPage(pageIDs[13], pageCaptions[13]);

    // Init the UI
    CreatePagesListBox();
end;

procedure DeInitializeSetup();
begin
    #ifdef GRAPHICAL_INSTALLER_PROJECT
    DeInitGraphicalInstaller();
    #endif
end;

// End of file (EOF)

Please notice: To compile this script you need to install the Graphical Installer. Feel free to ask any other questions (I am developer of GI).

Upvotes: 1

Related Questions