Skip to content

Commit

Permalink
Replace "WizardForm.Show" with "WizardForm.Visible := True".
Browse files Browse the repository at this point in the history
Show has a BringToFront call that we don't need. Changing Visible from False to True already brings the window to the front when not minimized. And when it is minimized, we don't want it becoming the active window.

This works around the same VCL issue as in preceding commits, where the Forms unit's WM_ACTIVATEAPP handler sets FAppIconic=False even though the window may still be minimized, which causes the next Application.Restore call to be a no-op.
  • Loading branch information
jordanrussell authored Dec 22, 2024
1 parent 7da3a11 commit d5e8603
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Projects/Src/Setup.MainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ procedure TMainForm.InitializeWizard;
WizardForm.SetCurPage(wpWelcome);
if InstallMode = imNormal then begin
WizardForm.ClickToStartPage; { this won't go past wpReady }
WizardForm.Show;
WizardForm.Visible := True;
end
else
WizardForm.ClickThroughPages;
Expand Down Expand Up @@ -195,7 +195,7 @@ function TMainForm.Install: Boolean;
else begin
if WizardWasHidden then begin
WizardWasHidden := False;
WizardForm.Show;
WizardForm.Visible := True;
end;
end;
DebugNotifyEntry(seRun, I);
Expand All @@ -206,7 +206,7 @@ function TMainForm.Install: Boolean;
end;
finally
if WizardWasHidden then
WizardForm.Show;
WizardForm.Visible := True;
WindowDisabler.Free;
if CheckIfRestartNeeded then begin
ChecksumAfter := MakePendingFileRenameOperationsChecksum;
Expand Down Expand Up @@ -276,7 +276,7 @@ function TMainForm.Install: Boolean;

Application.Restore;
if InstallMode = imSilent then
WizardForm.Show;
WizardForm.Visible := True;
WizardForm.Update;

SetStep(ssInstall, False);
Expand Down
10 changes: 4 additions & 6 deletions Projects/Src/Setup.WizardForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
NextButton.Visible := False;
CancelButton.Enabled := False;
if InstallMode = imSilent then
WizardForm.Show;
WizardForm.Visible := True;
WizardForm.Update;
try
DownloadTemporaryFileOrExtract7ZipArchiveProcessMessages := True;
Expand Down Expand Up @@ -2532,7 +2532,7 @@ procedure TWizardForm.NextButtonClick(Sender: TObject);
BackButton.Visible := False;
NextButton.Visible := False;
if InstallMode = imSilent then
WizardForm.Show;
WizardForm.Visible := True;
try
WizardForm.Update;
RmFoundApplications := QueryRestartManager(WizardComponents, WizardTasks) <> '';
Expand Down Expand Up @@ -3020,12 +3020,10 @@ procedure TWizardForm.ClickThroughPages;
{ After installation, we can't abort since e.g. a restart might be
needed. Instead, to avoid getting stuck in a loop, show the wizard
(even though this is a silent install) and let the user deal with the
problem on their own.
The taskbar button will be hidden at this point on very silent
installs (see SetupInstallMode); re-show it. }
problem on their own. }
Log('Failed to proceed to next wizard page; showing wizard.');
WizardForm.Visible := True;
Application.Restore;
WizardForm.Show;
Break;
end;
end;
Expand Down

0 comments on commit d5e8603

Please sign in to comment.