installationinno-setuppascalscript

Custom TLabel not displaying on FinishedPage in Inno Setup


I must be missing something obvious here. I'm trying to add a link to the release notes onto wpFinished but can't seem to make it show up:

I have a file finishedPage.iss which I include via #include "InnoDialogs\finishedPage.iss"; The file has the following content:

[Run]
Filename: "{app}\bin\{#MyAppExeName}"; \
    Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; \
    Flags: nowait postinstall skipifsilen
[Code]
// procedures to deal with page interaction
procedure ReleaseNotesClick(Sender: TObject);
var
    errorCode: Integer;
begin
    ShellExec('','https://example.com/Release_Notes', '', '', SW_SHOW, ewNoWait, errorCode)
end;

// build the page
procedure FinishedPage_Create;
var
    ReleaseNotesLink: TLabel;
begin
    ReleaseNotesLink := TLabel.Create(WizardForm);
    ReleaseNotesLink.Parent := WizardForm.FinishedPage;
    ReleaseNotesLink.Caption := 'Read the Releasenotes';
    ReleaseNotesLink.Enabled := True;
    ReleaseNotesLink.Visible := True;
    ReleaseNotesLink.AutoSize := True;
    ReleaseNotesLink.Left := WizardForm.FinishedLabel.Left;
    ReleaseNotesLink.Top := WizardForm.FinishedLabel.Top + ScaleY(100);
    ReleaseNotesLink.OnClick := @ReleaseNotesClick;
    ReleaseNotesLink.ParentFont := True;
    ReleaseNotesLink.Font.Style := ReleaseNotesLink.Font.Style + [fsUnderline, fsBold];
    ReleaseNotesLink.Font.Color := clBlue;
    ReleaseNotesLink.Cursor := crHand;
end;

In the CurPageChanged procedure in my main installer file I have:

procedure CurPageChanged(CurPageID: Integer);
begin
    if CurPageID = wpFinished then
        begin
            FinishedPage_Create();
        end;
end;

This compiles just fine, but I can't make it show up. I tried different positions as well, thinking perhaps it's just drawn behind something else. I'm using the same procedure for adding elements to other pages...

Any ideas what I'm missing?


Solution

  • Your label is hidden behind the RunList, which occupies the rest of the page.

    You have to shrink the list. For example:

    WizardForm.RunList.Height := ScaleY(24);
    
    ReleaseNotesLink.Left := WizardForm.RunList.Left;
    ReleaseNotesLink.Top :=
      WizardForm.RunList.Top + WizardForm.RunList.Height + ScaleY(8);
    

    enter image description here