Search code examples
inno-setuppascalscript

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?


Solution

  • 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.