Can not create label on Inno Setup Welcome page - inno-setup

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.

Related

Inno Setup: add fields to InputQueryPage depending on components selected

I have an input query page, which asks the user for ports depending on what components are selected.
procedure InitializeWizard;
begin
{ Create the page }
ConfigPage :=
CreateInputQueryPage(
wpSelectComponents, 'User input', 'User input',
'Please specify the following information, then click Next.');
{ Add items (False means it's not a password edit) }
if IsComponentSelected('broker') then
begin
ConfigPage.Add('MQTT Broker port:', False);
{ Set initial values (optional) }
ConfigPage.Values[0] := ExpandConstant('1883');
end;
end;
The issue I am finding here is that InitializeWizard is always called prior to component selection, so IsComponentSelected('broker') is always called.
Is there any way around this? How can I achieve this?
It's not easy. For a really generic solution, you would have to create the custom page only when leaving the components selection page (e.g. in NextButtonClick with CurPageID equal wpSelectComponents). That's doable, but Inno Setup allows user to go back to the components page. When the user does that, you would have to remove the custom page, re-creating it later. But you would lose the data the user might have entered on the custom page. So you would have to persist the data somehow. All that is doable, but lot of work.
If it is about few input boxes only, consider instead disabling the boxes that are not relevant for the current components selection:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = ConfigPage.ID then
begin
ConfigPage.Edits[0].Enabled := IsComponentSelected('foo');
ConfigPage.PromptLabels[0].Enabled := ConfigPage.Edits[0].Enabled;
ConfigPage.Edits[1].Enabled := IsComponentSelected('bar');
ConfigPage.PromptLabels[1].Enabled := ConfigPage.Edits[1].Enabled;
end;
end;
A step further would be to hide the boxes instead of disabling them (use Visible instead of Enabled). But then you would have to rearrange the boxes. But that's still easier then re-building the page.

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)

Skinned innosetup showing text instead of scrollbar

I am trying to create a new installer using InnoSetup 5.5.8 (u) and skinned using CodeJock's ISSkin v3.0.0. I am using one of the provided example skins (Office 2007 Black) applied by copying the code example from their website (http://isskin.codejock.com/gettingstarted.asp).
I am having some issues on our license agreement page. We currently show this using an RTF file in the default wizard screen. The problem is that on some machines we're getting text ('bef') showing instead of the skinned scrollbar:
The text (which is probably part of an error message) is also unreliable, as sometimes I see an unskinned, disabled scrollbar instead.
I reliably see the expected skin version on my main dev VM (Windows 8 Pro, Delphi and InnoSetup/ISSkin installed) and it's intermittent on my host machine (Win 10, no development software installed)
Has anyone encountered anything like this and got a decent fix/workaround? I have confirmed that removing the skinning code provides a working scrollbar, so that provides a workable solution for now.
This looks like a bug in skinning mechanism but the 'bef' is really weird I have never seen that. What official support says?
Maybe you could try to update/invalidate the component so the scrollbar is redrawn correctly.
Also you can try the Graphical Installer (http://www.graphical-installer.com) which is different skinning mechanism and check for this behavior there (sorry for little self promo :)
My solution for plaintext format:
procedure InitializeWizard();
var
NewLicenseMemo: TMemo;
begin
WizardForm.LicenseMemo.Visible := false;
NewLicenseMemo := TMemo.Create(WizardForm);
with NewLicenseMemo do
begin
Parent := WizardForm.LicenseMemo.Parent;
Left := WizardForm.LicenseMemo.Left;
Top := WizardForm.LicenseMemo.Top;
Width := WizardForm.LicenseMemo.Width;
Height := WizardForm.LicenseMemo.Height;
Text := WizardForm.LicenseMemo.Text;
ReadOnly := True;
ScrollBars := ssVertical;
end;
end;

How to stretch small wizard image over whole area in 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;

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:

Resources