Fix progress bar during post-install: step-based advancement with status labels
Replace marquee style (unavailable constant) with manual step-based progress. SetStatusInit calculates total steps, SetStatus advances bar and updates label at each major operation so users can see activity instead of a frozen bar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -876,13 +876,27 @@ end;
|
|||||||
|
|
||||||
// ─── Progress helpers ────────────────────────────────────────────────────────
|
// ─── Progress helpers ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// Switch the wizard progress bar to marquee (animated) mode and update the
|
// Update the status label and advance the progress bar during post-install.
|
||||||
// status label so the user knows what is happening during the post-install phase.
|
// Call SetStatusInit first to reset the bar, then SetStatus for each step.
|
||||||
|
var
|
||||||
|
GaugeStep, GaugeTotal: Integer;
|
||||||
|
|
||||||
|
procedure SetStatusInit(Total: Integer);
|
||||||
|
begin
|
||||||
|
GaugeTotal := Total;
|
||||||
|
GaugeStep := 0;
|
||||||
|
WizardForm.ProgressGauge.Min := 0;
|
||||||
|
WizardForm.ProgressGauge.Max := Total;
|
||||||
|
WizardForm.ProgressGauge.Position := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure SetStatus(const Msg: String);
|
procedure SetStatus(const Msg: String);
|
||||||
begin
|
begin
|
||||||
WizardForm.ProgressGauge.Style := pbstMarquee;
|
if GaugeStep < GaugeTotal then
|
||||||
WizardForm.StatusLabel.Caption := Msg;
|
GaugeStep := GaugeStep + 1;
|
||||||
WizardForm.FileNameLabel.Caption := '';
|
WizardForm.ProgressGauge.Position := GaugeStep;
|
||||||
|
WizardForm.StatusLabel.Caption := Msg;
|
||||||
|
WizardForm.FileNameLabel.Caption := '';
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -923,6 +937,16 @@ begin
|
|||||||
ForceDirectories(LogDir);
|
ForceDirectories(LogDir);
|
||||||
LogPath := LogDir + '\printer_install.log';
|
LogPath := LogDir + '\printer_install.log';
|
||||||
|
|
||||||
|
// Initialise progress bar: fixed steps + one per printer being changed
|
||||||
|
begin
|
||||||
|
var StepCount: Integer;
|
||||||
|
StepCount := 4; // cleanup + staging + 2x spooler restart
|
||||||
|
for I := 0 to GetArrayLength(PrinterDataArray) - 1 do
|
||||||
|
if PrinterSelectionPage.Values[I] <> PrinterDataArray[I].IsInstalled then
|
||||||
|
StepCount := StepCount + 1;
|
||||||
|
SetStatusInit(StepCount);
|
||||||
|
end;
|
||||||
|
|
||||||
// ── Step 0: Remove legacy printers from old print servers ────────────────
|
// ── Step 0: Remove legacy printers from old print servers ────────────────
|
||||||
SetStatus('Removing legacy printers...');
|
SetStatus('Removing legacy printers...');
|
||||||
CleanedCount := CleanupLegacyPrinters();
|
CleanedCount := CleanupLegacyPrinters();
|
||||||
@@ -1192,10 +1216,10 @@ begin
|
|||||||
SetDefaultPrinterAllUsers(DefaultPrinter);
|
SetDefaultPrinterAllUsers(DefaultPrinter);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Restore progress bar to normal completed state
|
// Fill bar to completion
|
||||||
WizardForm.ProgressGauge.Style := pbstNormal;
|
|
||||||
WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max;
|
WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max;
|
||||||
WizardForm.StatusLabel.Caption := 'Installation complete.';
|
WizardForm.StatusLabel.Caption := 'Installation complete.';
|
||||||
|
WizardForm.FileNameLabel.Caption := '';
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
|
|
||||||
// Save log
|
// Save log
|
||||||
|
|||||||
Reference in New Issue
Block a user