Inno Setup - How to create a personalized FilenameLabel with the names I want?

前端 未结 1 1304
无人共我
无人共我 2020-12-10 08:58

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 installi

相关标签:
1条回答
  • 2020-12-10 09:37

    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;
    

    0 讨论(0)
提交回复
热议问题