Remove image from the last Finished page of Inno Setup - inno-setup

How to customize last page (wpFinished) to only have a message, but keep the bottom buttons, like this:
I don't want the image on the left that is there by default.
I was trying to create new page, but don't know how to hide the default finished page or add bottom buttons (Back, Finished, Cancel) on new page.

Hide the WizardBitmapImage2 control and extend remaining controls accordingly.
Something like this:
[Code]
procedure ExtendFinishedPageControl(Control: TControl);
begin
Control.Left := Control.Left - WizardForm.WizardBitmapImage2.Width;
Control.Width := Control.Width + WizardForm.WizardBitmapImage2.Width;
end;
procedure InitializeWizard();
begin
WizardForm.WizardBitmapImage2.Visible := False;
ExtendFinishedPageControl(WizardForm.RunList);
ExtendFinishedPageControl(WizardForm.NoRadio);
ExtendFinishedPageControl(WizardForm.YesRadio);
ExtendFinishedPageControl(WizardForm.FinishedLabel);
ExtendFinishedPageControl(WizardForm.FinishedHeadingLabel);
end;

Related

Checking if only one specific component is selected in Inno Setup

I have a requirement to skip a page when only a particular component is selected in the component selection page. Please look at the below image
[Components]
Name: DBS\TRACE; Types: DBS TBLWOS; Description: DBS Tracing Bodylife Database;
The requirement is to skip a page when the option "DBS Tracing Bodylife Database" (highlighted in the image) alone is selected and clicked on Next button. If I select only that option, I am successfully able to skip the page using below code.
if PageID = PageToBeSkipped.ID then begin
Result := not (IsComponentSelected('not DBS\TRACE'));
end;
But If I select any other additional component along with the "DBS Tracing Bodylife Database" from this page which is nearly 20, the page should not be skipped. The above code skips the page if any additional component is selected too.
How can I handle this?
Thanks in advance!
To test if any component, except one specific, is selected, you can use WizardSelectedComponents function (which returns a comma-separated list of selected components).
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = PageToBeSkipped.ID then
begin
Result := (CompareText(WizardSelectedComponents(False), 'DBS,DBS\TRACE') = 0);
end;
end;
Note that the WizardSelectedComponents returns even "partially" selected components groups.

Inno Setup wizard change page after user input

I want to make a wizard. When the user choose yes, then the page x should follow. When the user choose no, then the page y should follow. At the moment it is only working for me with static pages, so it does not matter, what the user chooses always the same page follows... how can I change this? Please have somebody an idea?
Here is an extract:
ExistPage := CreateInputOptionPage(OldPage.ID,
'', '', 'If you choose "Yes" then the package will be installed automatically with this setup',True, False);
// Add items
ExistPage.Add('Yes');
ExistPage.Add('No');
// Set initial values (optional)
ExistPage.SelectedValueIndex := 0;
TexPage := CreateInputDirPage(ExistPage.ID,
'Root installation directory', 'Please select installation directory',
'',
True, 'New Folder');
TexPage.Add('');
// Set initial value (optional)
TexPage.Values[0] := ExpandConstant('C:\');
When you create your page you can store the page ID into a variable:
// InitializeWizard is called when the wizard is about to begin.
// This is where we add any custom pages into the installation process.
// The relevant XXX_CreatePage methods should be defined BEFORE this method.
procedure InitializeWizard();
begin
// Add the Application Settings page just after the Selected Tasks page
idAppSettingsPage := AppSettings_CreatePage(wpSelectTasks)
end;
If you were to cache the result of your users radio choice into a public variable then you might be able to use this:
function ShouldSkipPage(PageID: Integer): Boolean;
begin
// We don't want to show the select dir, select program group or application settings
// pages if we are upgrading.
if ((PageID = wpSelectDir) or (PageID = idAppSettingsPage) or (PageID = wpSelectProgramGroup)) then
Result := bIsUpgrading
else
Result := False;
end;
This is something I have used in my setup to selectively show pages during the install process. I am just not sure how you check for a custom page ID.
I am just showing the mechanics. If you know you are now about to show page Y, you can decide to show it if variable AA was set to 1. Make sense?

Inno Setup Place controls on wpPreparing Page

I am trying to place a label on the wpPreparing page to indicate uninstallation of an existing version, prior to running the new installation. Here is my code:
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
UninstallingLabel: TNewStaticText;
intResultCode: Integer;
begin
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.StatusLabel.Left;
Top := WizardForm.StatusLabel.Top;
Parent := wpPreparing.Surface;
end;
if strExistingInstallPath <> '' then
begin
Exec(GetUninstallString, '/verysilent /suppressmsgboxes', '', SW_HIDE,
ewWaitUntilTerminated, intResultCode);
end;
end;
The trouble is it does not seem to like Parent := wpPreparing.Surface and compiling fails with a
Semicolon (;) expected
error. This syntax works when adding a label to a custom created page. Why does this fail when trying to add it to wpPreparing?
The wpPreparing is not an object, it's just a numerical constant.
The WizardForm.PreparingPage holds a reference to the "Preparing to Install" page. Note that it is of type TNewNotebookPage already, not TWizardPage. So you use it directly as a parent.
Also note that the StatusLabel is on the "Installing" page. You probably want to relate your new label to the PreparingLabel instead.
And you have to create the UninstallingLabel.
UninstallingLabel := TNewStaticText.Create(WizardForm);
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.PreparingLabel.Left;
Top := WizardForm.PreparingLabel.Top;
Parent := WizardForm.PreparingPage;
end;
Though do you really want to shadow the PreparingLabel (as you use its coordinates).
What about reusing it instead?
WizardForm.PreparingLabel.Caption := 'Uninstalling existing version...';
I've replayed your code. It works if you use just WizardForm as the parent. But it's in the top left corner of the form...
wpPreparing is the name of a constant that holds the ID of the correspnding page.
And you have to create an instance of UninstallingLabel

How to disable edit boxes from a TInputQueryWizardPage input page?

Is it possible to conditionally disable or hide edit boxes from a TInputQueryWizardPage input page (page created by using CreateInputQueryPage function) ?
I have 4 edit boxes and I need to disable/hide the last two of them, based on the input from the previous wizard page. How can I do it ?
You can access them through the TInputQueryWizardPage.Edits indexed property:
[Code]
var
FirstEditIndex: Integer;
SecondEditIndex: Integer;
InputPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
InputPage := CreateInputQueryPage(wpWelcome, 'Caption', 'Dscription', 'SubCaption');
// the Add method returns the Index of the just added edit box, and
// you need to store those indexes to access the edit boxes later on
FirstEditIndex := InputPage.Add('Name:', False);
SecondEditIndex := InputPage.Add('Surname:', False);
// access the edits through the stored indexes; in your case this will
// happen in the other event, so take this script as a showcase
InputPage.Edits[FirstEditIndex].Enabled := False;
InputPage.Edits[SecondEditIndex].Visible := False;
end;

How can I show a "please wait" window while checking for prerequisites in my installer?

I do a number of checks in the InitializeSetup function in my script. These take about 10 seconds to complete, during which time nothing is displayed except for the window button on the taskbar (clicking it yields nothing). I would like to show a simple "Please wait" window instead. How can I do this?
Here is sample script that shows how you can create a custom dialog.
Basically create a custom form and place the custom control on it. You can use this as starting point to get the dialog appear as you wish.
[Setup]
AppName='Test Date Script'
AppVerName='Test Date Script'
DefaultDirName={pf}\test
[Code]
function InitializeSetup() : boolean;
var
DlgWait : TSetupForm;
lblWait : TLabel;
I : Integer;
begin
dlgWait := CreateCustomForm;
dlgWait.FormStyle := bsDialog;
dlgWait.Position := poMainFormCenter;
lblWait := TLabel.Create(dlgWait);
lblWait.Parent := dlgWait;
lblWait.Caption := 'Please Wait';
lblWait.Visible := True;
dlgWait.Show;
dlgWait.Refresh; // Process the paint message
for I := 0 to 10 do
begin
Sleep(1000); // Simulate Functions taking 10 sec
dlgWait.Refresh;
end;
DlgWait.Free;
end;

Resources