How to stretch small wizard image over whole area in Inno Setup? - inno-setup

I need to stretch small wizard image in Inno Setup over the whole bitmap area and hide the labels like "select installation folder"... etc. What would be the corresponding code for this?

Set bounds of the WizardSmallBitmapImage to that of its parent
Hide the labels (PageDescriptionLabel and PageNameLabel)
procedure InitializeWizard();
begin
with WizardForm.WizardSmallBitmapImage do
SetBounds(Parent.Left, Parent.Top, Parent.Width, Parent.Height);
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.PageNameLabel.Visible := False;
end;

Related

Can not create label on Inno Setup Welcome page

I'm trying to create a label (or a bitmap) on the welcome page using this code:
LabelTarget := TLabel.Create(WizardForm);
with LabelTarget do
begin
Parent := WizardForm.WelcomePage;
Left := ScaleX(198);
Top := ScaleY(105);
Caption := 'Target';
end;
It won't work, but if I change the parent for example to WizardForm.InstallingPage it will create that label on Installing page. Where is the problem?
It's because almost whole area of the WelcomePage is covered by an opaque WelcomeLabel2.
The TLabel is not a real Windows control. It is a virtual one, drawn by the form itself. So it gets hidden by any other real Windows control, even if the TLabel is technically on top of it (what it is, as your LabelTarget is created later than the WelcomeLabel2). The WelcomeLabel2 is TStaticText, what is a real control. So it hides your LabelTarget.
To solve this either:
Shrink the WelcomeLabel2 height, or
Change your LabelTarget to TStaticText.

Inno Setup - aligning custom button with the Cancel button

I ve got problems to set a button on the same topsize as the Cancel button when im using WizardSizePercent = 150 in the Setup section.
Here is my code:
AboutButton := TNewButton.Create(WizardForm);
AboutButton.Parent := WizardForm;
AboutButton.Left := WizardForm.CancelButton.Left;
AboutButton.Top := WizardForm.CancelButton.Top;
AboutButton.Width := WizardForm.CancelButton.Width;
AboutButton.Height := WizardForm.CancelButton.Height;
I think Inno Setup doesn't notice the WizardSizePercent, because it only uses the regular WizardForm size.
I assume your code is in InitializeWizard. That event function occurs before WizardSizePercent is applied. If you want your button to correctly align when the wizard window changes size, either due to WizardSizePercent or WizardResizable, you need follow their documentation:
Use Anchors and KeepSizeY properties to add full support for WizardResizable and WizardSizePercent to all your custom controls, custom wizard pages and TSetupForm forms if you have any. See the CodeClasses.iss example script for an example.
So particularly:
AboutButton.Anchors := WizardForm.CancelButton.Anchors;
CancelButton.Anchors is [akRight, akBottom]. If your "About" button should be left-aligned, use:
AboutButton.Anchors := [akLeft, akBottom];
Related question:
Adding a Print button to the License page in Inno Setup (revisited for Inno Setup 6)

In Inno Setup, how can I set which component gets an initial focus on "Select Components" page

When the wpSelectComponents page is shown, I'd like to set focus to a particular item/component in the list. Is there a way to do this?
Set ItemIndex property of WizardForm.ComponentsList, like:
WizardForm.ComponentsList.ItemIndex := 2;
Note that focus of the list item is not rendered, until the list itself receives a focus:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectComponents then
begin
WizardForm.ActiveControl := WizardForm.ComponentsList;
end;
end;
You need to use WinAPI to achieve this.
Unfortunately I could not find any Pascal example so have a look on this C++ code: Selecting and Highlighting an Item from List View.
Calling this code from Inno Setup requires to call WinApi dlls functions so maybe writing this feature as small C++ plugin could be easier.

How to hide the label at the bottom of the page in select directory page in inno setup

I want to remove the label at the bottom of the page where i select the directory to install the components. The label shows minimum disk space required to install applications.
You want to hide the DiskSpaceLabel control:
[Code]
procedure InitializeWizard;
begin
WizardForm.DiskSpaceLabel.Visible := False;
end;
That will hide the label marked on this screenshot:

Show License Agreement link in Inno Setup while installation

I am using Inno Setup for my application. I want to show a link (License Agreement) in Inno Setup while installation (except separate License Agreement Wizard). I want combine this link with some task. When user clicks that link it will navigate to particular URL.
I know I'm quite late here... The following code script creates the License Agreement link label in the bottom left part of the wizard form. That label has a blue underlined font and a hand cursor on hover so it looks and feels like a common web page link. On its click event a specified URL is opened in a default web browser. This label is then visible on all wizard pages except the license page one:
[Code]
var
LicenseLinkLabel: TLabel;
procedure LicenseLinkClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('', 'http://www.stackoverflow.com', '', '', SW_SHOW, ewNoWait,
ErrorCode);
end;
procedure InitializeWizard;
begin
LicenseLinkLabel := TLabel.Create(WizardForm);
LicenseLinkLabel.Parent := WizardForm;
LicenseLinkLabel.Left := 8;
LicenseLinkLabel.Top := WizardForm.ClientHeight -
LicenseLinkLabel.ClientHeight - 8;
LicenseLinkLabel.Cursor := crHand;
LicenseLinkLabel.Font.Color := clBlue;
LicenseLinkLabel.Font.Style := [fsUnderline];
LicenseLinkLabel.Caption := 'License Agreement';
LicenseLinkLabel.OnClick := #LicenseLinkClick;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
LicenseLinkLabel.Visible := CurPageID <> wpLicense;
end;
And the result (click to enlarge):
Create an RTF formatted license text (with Wordpad for very small file size) and type the hyperlink in the text as pure text, no extra functions needed (eg. 'http://stackoverflow.com'). InnoSetup will display this URL and make it clickable. Be aware that e-mail links do not work properly.
Wanna try? Save this entire text Wordpad, save as RTF and link it to InnoSetup.
Dutch

Resources