How to create a personalized FilenameLabel
with the names I want? How to implement the suggestion from Inno Setup - How to hide certain filenames while installing? (FilenameLabel) (third option, CurInstallProgressChanged, copy the files name, you want to show from the hidden to the custom label¨).
I see this code:
procedure InitializeWizard;
begin
with TNewStaticText.Create(WizardForm) do
begin
Parent := WizardForm.FilenameLabel.Parent;
Left := WizardForm.FilenameLabel.Left;
Top := WizardForm.FilenameLabel.Top;
Width := WizardForm.FilenameLabel.Width;
Height := WizardForm.FilenameLabel.Height;
Caption := ExpandConstant('{cm:InstallingLabel}');
end;
WizardForm.FilenameLabel.Visible := False;
end;
But, how to define, if is possible, the names of files that i want with CurInstallProgressChanged
?
As explained in the answer you've linked:
- create a new custom "filename" label;
- hide the original
FilenameLabel
;
- implement the
CurInstallProgressChanged
to map the filename to anything you want to display and show it on the custom label.
[Files]
Source: "data1.dat"; DestDir: {app}
Source: "data2.dat"; DestDir: {app}
Source: "data3.dat"; DestDir: {app}
[Code]
var
MyFilenameLabel: TNewStaticText;
procedure InitializeWizard();
begin
MyFilenameLabel := TNewStaticText.Create(WizardForm);
{ Clone the FilenameLabel }
MyFilenameLabel.Parent := WizardForm.FilenameLabel.Parent;
MyFilenameLabel.Left := WizardForm.FilenameLabel.Left;
MyFilenameLabel.Top := WizardForm.FilenameLabel.Top;
MyFilenameLabel.Width := WizardForm.FilenameLabel.Width;
MyFilenameLabel.Height := WizardForm.FilenameLabel.Height;
MyFilenameLabel.AutoSize := WizardForm.FilenameLabel.AutoSize;
{ Hide real FilenameLabel }
WizardForm.FilenameLabel.Visible := False;
end;
procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
Filename: string;
begin
Filename := ExtractFileName(WizardForm.FilenameLabel.Caption);
{ Map filenames to descriptions }
if CompareText(Filename, 'data1.dat') = 0 then Filename := 'Some hilarious videos'
else
if CompareText(Filename, 'data2.dat') = 0 then Filename := 'Some awesome pictures'
else
if CompareText(Filename, 'data3.dat') = 0 then Filename := 'Some cool music';
MyFilenameLabel.Caption := Filename;
end;