1

So I got this in my .iss file:

[Files]
Source: "WizModernImageTop2.bmp"; Flags: dontcopy

[Code]

function CloneStaticTextToLabel(StaticText: TNewStaticText): TLabel;
begin
  Result := TLabel.Create(WizardForm);
  Result.Parent := StaticText.Parent;
  Result.Left := StaticText.Left;
  Result.Top := StaticText.Top;
  Result.Width := StaticText.Width;
  Result.Height := StaticText.Height;
  Result.AutoSize := StaticText.AutoSize;
  Result.ShowAccelChar := StaticText.ShowAccelChar;
  Result.WordWrap := StaticText.WordWrap;
  Result.Font := StaticText.Font;
  StaticText.Visible := False;
  WizardForm.PageDescriptionLabel.Font.Color := clRed;
  WizardForm.PageNameLabel.Font.Color := clRed;
end;

var
  PageDescriptionLabel: TLabel;
  PageNameLabel: TLabel;

procedure InitializeWizard;
var
  BitmapImage: TBitmapImage;
begin
  ExtractTemporaryFile('WizModernImageTop2.bmp');
  BitmapImage := TBitmapImage.Create(WizardForm);
  BitmapImage.Parent := WizardForm.MainPanel;
  BitmapImage.Width := WizardForm.MainPanel.Width;
  BitmapImage.Height := WizardForm.MainPanel.Height;
  BitmapImage.Stretch := True;
  BitmapImage.AutoSize := False;
  BitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizModernImageTop2.bmp'));
  WizardForm.WizardSmallBitmapImage.Visible := True;
  WizardForm.PageDescriptionLabel.Visible := True;
  WizardForm.PageNameLabel.Visible := True;


  { Create TLabel equivalent of standard TNewStaticText components }
  PageNameLabel := CloneStaticTextToLabel(WizardForm.PageNameLabel);
  PageDescriptionLabel := CloneStaticTextToLabel(WizardForm.PageDescriptionLabel);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  { Update the custom TLabel components from the standard hidden components }
  PageDescriptionLabel.Caption := WizardForm.PageDescriptionLabel.Caption;
  PageNameLabel.Caption := WizardForm.PageNameLabel.Caption;
end;

What I want to achieve:

Change colour/size (where needed) of PageNameLabel and PageDescriptionLabel to white so to become visible. Right now its black on black. I don't know the font parameters for the WizardForm elements, eh...

UPDATE: If anyone is wiling to use an image in his installer instead displaying the small WizardSmallImage icon to the right, use the provided code above, it makes it so labels are displayed on top of the image with transparency enabled. It requires Unicode version of Inno to work.

Janski
  • 13
  • 5
  • But `PageDescriptionLabel` and `PageNameLabel` are not transparent in the first place. So they will have gray background over your (supposedly) black image. I assume, you must be using this solution: [Transparency under text in page name and description labels](https://stackoverflow.com/q/46178215/850848) - but your question does not reflect that. – Martin Prikryl Aug 07 '18 at 13:13
  • Actually I am not using any other code than what I have linked in the OP and the text has transparent background: https://i.imgur.com/KUJ66hr.jpg Just an example image to see the transparency, what I would use is real image not just gradient. – Janski Aug 07 '18 at 14:17

1 Answers1

0

Use TNewStaticText.Font.Color to change a label color.

WizardForm.PageDescriptionLabel.Font.Color := clWhite;
WizardForm.PageNameLabel.Font.Color := clWhite;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Okay I tried adding these 2 lines: WizardForm.PageDescriptionLabel.Font.Color := clWhite; WizardForm.PageNameLabel.Font.Color := clWhite; Just under: WizardForm.PageNameLabel.Visible := True; and I see no change whatsoever. – Janski Aug 07 '18 at 14:24
  • What version of Windows are you using? – Martin Prikryl Aug 07 '18 at 14:31
  • I am using Windows 7 and the Windows Classic color scheme, I thought you maybe fell its XP. Just Win 7 64bits. I failed to mention I have the ANSI edition of Inno. – Janski Aug 07 '18 at 14:44
  • If It run your code, with my addition (`.Font.Color := clWhite`) compiled with Inno Setup 5.6.1 (tested with both Ansi and Unicode with same results) and run the installer on Windows 7 with "Windows Classic" theme, loading a solid black image, I get this: https://i.stack.imgur.com/DcIGf.png - I.e. as expected, the label is not transparent and the white color is applied. For comparison with `clRed`: https://i.stack.imgur.com/9U80u.png – Martin Prikryl Aug 07 '18 at 19:28
  • What gives? Images wont open (says deleted). What is the best solution you recommend then if it wont work for you, do this: [Transparency under text in page name and description labels](https://stackoverflow.com/q/46178215/850848)? I think I have tried it few times and only the image was displaying, not the labels then I went to look for better code and found what I currently have. I really wanna have that feature in this installer and maybe have a custom skin afterwards. Too bad Inno does not support WYSIWIG interface and its all code you can't know by yourself. – Janski Aug 07 '18 at 21:37
  • Actually I gave the [Transparency under text in page name and description labels?](https://stackoverflow.com/questions/46178215/inno-setup-transparency-under-text-in-page-name-and-description-labels) code you posted there another try. The color changes (used clRed to be sure) but only if I remove the image code block, e.g. what I have posted in the question. Seems the image code should be tweaked to work with yours. else colors wont change. How I can do that? – Janski Aug 07 '18 at 21:56
  • There was temporary outage on `stack.imgur.com`. The links in my comment now work. + Anyway, edit your full code with the "transparency" into your question. – Martin Prikryl Aug 08 '18 at 06:27
  • Okay you are right it seems. I edited the code in the question, could you please have a look at it and tell me whats wrong and why I am using the transparency under text but there is no transparency at all? I am completely confused, jesus... – Janski Aug 08 '18 at 10:03
  • For transparency you need Unicode version of Inno Setup and themed Windows. – Martin Prikryl Aug 08 '18 at 11:13
  • Well then I am dumb as f***. I will be installing the unicode edition tonight, meantime this will work across all Wizard pages of Inno (not custom pages), right? If I need to change font parameters, I still can do it just like doing the coloring thing? – Janski Aug 08 '18 at 12:57
  • Yes, just that you misplaced the code for setting color. It should go to `InitializeWizard`, before calls to `CloneStaticTextToLabel`. – Martin Prikryl Aug 08 '18 at 13:02
  • I tried it and it really works but I am thinking, will the transparency work across all Windows versions the same way I see it myself, cause it wont work for Windows Classic like you said, dunno whats the difference. I can test that using VirtualBox however I am interested having the installer working across Windows XP as well. – Janski Aug 08 '18 at 16:37
  • It should work on any version with themes enabled. For XP see https://i.stack.imgur.com/feBNG.png - The difference is that the "classic" theme is not really a theme, it actually disables themes. With themes disabled, drawing of controls is completely different, with the side effect that transparency is not supported in `TLabel`. – Martin Prikryl Aug 09 '18 at 07:56
  • Thanks for clearing up this for me. Appreciate the help. I think others looking for help will value it too, so I am not gonna delete the question. It may help someone else struggling to have labels and image both. Cheers! – Janski Aug 09 '18 at 12:51
  • How do I approve an answer? I don't see a button for that anywhere, excuse my poor skills using this website. – Janski Aug 09 '18 at 15:35
  • Aaah, damn. Done too. Thanks! – Janski Aug 09 '18 at 16:24