Inno Setup-如何使用我想要的名称创建个性化FilenameLabel? [英] Inno Setup - How to create a personalized FilenameLabel with the names I want?

查看:86
本文介绍了Inno Setup-如何使用我想要的名称创建个性化FilenameLabel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用我想要的名称创建个性化的FilenameLabel?如何实施 Inno设置-如何隐藏的建议安装时某些文件名? (FilenameLabel)(第三个选项,CurInstallProgressChanged,复制要从隐藏显示的文件名到自定义标签¨).

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¨).

我看到以下代码:

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;

但是,如果可能的话,如何用CurInstallProgressChanged定义我想要的文件名?

But, how to define, if is possible, the names of files that i want with CurInstallProgressChanged?

推荐答案

如您所链接的答案中所述:

As explained in the answer you've linked:

  • 创建一个新的自定义文件名"标签;
  • 隐藏原始的FilenameLabel;
  • 实施 CurInstallProgressChanged 来映射文件名到要显示并显示在自定义标签上的任何内容.
  • 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;

这篇关于Inno Setup-如何使用我想要的名称创建个性化FilenameLabel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆