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 ────────────────────────────────────────────────────────
|
||||
|
||||
// Switch the wizard progress bar to marquee (animated) mode and update the
|
||||
// status label so the user knows what is happening during the post-install phase.
|
||||
// Update the status label and advance the progress bar during post-install.
|
||||
// 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);
|
||||
begin
|
||||
WizardForm.ProgressGauge.Style := pbstMarquee;
|
||||
WizardForm.StatusLabel.Caption := Msg;
|
||||
WizardForm.FileNameLabel.Caption := '';
|
||||
if GaugeStep < GaugeTotal then
|
||||
GaugeStep := GaugeStep + 1;
|
||||
WizardForm.ProgressGauge.Position := GaugeStep;
|
||||
WizardForm.StatusLabel.Caption := Msg;
|
||||
WizardForm.FileNameLabel.Caption := '';
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
@@ -923,6 +937,16 @@ begin
|
||||
ForceDirectories(LogDir);
|
||||
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 ────────────────
|
||||
SetStatus('Removing legacy printers...');
|
||||
CleanedCount := CleanupLegacyPrinters();
|
||||
@@ -1192,10 +1216,10 @@ begin
|
||||
SetDefaultPrinterAllUsers(DefaultPrinter);
|
||||
end;
|
||||
|
||||
// Restore progress bar to normal completed state
|
||||
WizardForm.ProgressGauge.Style := pbstNormal;
|
||||
// Fill bar to completion
|
||||
WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max;
|
||||
WizardForm.StatusLabel.Caption := 'Installation complete.';
|
||||
WizardForm.FileNameLabel.Caption := '';
|
||||
Application.ProcessMessages;
|
||||
|
||||
// Save log
|
||||
|
||||
Reference in New Issue
Block a user