Feature request: Unable to add a postinstal task

30 views
Skip to first unread message

Sergey Rozhenko

unread,
Jun 19, 2021, 3:37:59 PM6/19/21
to innosetup
I need to add "Keep installation files" to postinstall dialog where "View ReadMe.txt" and such are located. The only official way to add items to it seems to be through [Run].
I tried this code:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID <> wpFinished then  exit;
WizardForm.RunList.AddCheckBox('Keep installed files', '', 0, true, true, false, false, nil);
end;
But it fails if there are no Run entries or launches the first entry if there is one (thus, it ends up being launched twice).

Sergey Rozhenko

unread,
Jun 20, 2021, 4:12:40 AM6/20/21
to innosetup
I was able to work around it by creating an identical CheckListBox in its place. This means I can't use post-install entries in [Run], but that's totally fine. Here's the code just in case:

var
PostTasks: TNewCheckListBox;

procedure WizardResized(Sender: TObject);
var
a: TNewCheckListBox;
begin
a:= WizardForm.RunList;
with PostTasks do
begin
Left:= a.Left;
Top:= a.Top;
Width:= a.Width;
Height:= a.Height;
end;
end;

procedure InitializeWizard;
var
page: TWizardPage;
a: TNewCheckListBox;
begin
page:= PageFromID(wpFinished);
PostTasks:= TNewCheckListBox.Create(page);
with PostTasks do
begin
Parent:= page.Surface;
AddCheckBox('Keep installation archives', '', 0, true, true, false, false, nil);
a:= WizardForm.RunList;
Flat:= a.Flat;
MinItemHeight:= a.MinItemHeight;
Offset:= a.Offset;
BorderStyle:= a.BorderStyle;
Font:= a.Font;
ShowLines:= a.ShowLines;
WantTabs:= a.WantTabs;
RequireRadioSelection:= a.RequireRadioSelection;
ParentBackground:= a.ParentBackground;
end;
WizardResized(WizardForm);
WizardForm.OnResize:= @WizardResized;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssDone) and (PostTasks <> nil) and PostTasks.Checked[0] then
Log('checked');
end;


воскресенье, 20 июня 2021 г. в 02:37:59 UTC+7, Sergey Rozhenko:
Reply all
Reply to author
Forward
0 new messages