inno-setup - Inno Setup 向页面添加描述文本
问题描述
我在理解如何使用 Inno Setup 时遇到了一些问题。我创建了这个脚本来安装我的应用程序:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "MyApp"
#define MyAppVersion "1.0"
#define MyAppPublisher "Myself"
#define MyAppExeName "MyApp.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{5FA0A2CF-7FD4-4464-AF88-4B73D0857D03}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\{#MyAppName}
DisableDirPage=no
DefaultGroupName=MyApp
;DisableProgramGroupPage=yes
OutputDir=D:\test
OutputBaseFilename=MyApp
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest
UninstallDisplayName=MyApp {#MyAppName}
SetupIconFile="D:\MyApp\MyApp.ico"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "D:\MyApp\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\MyApp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[CustomMessages]
FileTemplateDescription=Test description
[Code]
var
DataDirPage: TInputDirWizardPage;
FileTemplatePage: TInputQueryWizardPage;
CustomStatusLabel: TNewStaticText;
procedure InitializeWizard;
begin
{ This part creates the page where to choose the data location directory }
DataDirPage := CreateInputDirPage(wpSelectDir,
'Select data directory', 'Where are the files you want to use?',
'Select the folder where the data files are located, then click Next.',
False, '');
DataDirPage.Add('');
DataDirPage.Values[0] := GetPreviousData('DataDir', '');
{ This part creates the page where to add the filetemplate }
FileTemplatePage := CreateInputQueryPage(DataDirPage.ID,
'File template', 'This is an advance option, do not change it if you are not sure.',
'Please specify the file template, then click Next.');
// Add items (False means it's not a password edit)
FileTemplatePage.Add('File template:', False);
// Set initial values (optional)
FileTemplatePage.Values[0] := 'GlobalStatReanalysis_temp_sal_ssh_u_v_{{dateTime:%Y%m%d}.nc';
// Description of the file template
// FileTemplatePage.Description := 'Test of description.';
{ S := CustomMessage('FileTemplateDescription');}
CustomStatusLabel := TNewStaticText.Create(WizardForm);
CustomStatusLabel.Parent := WizardForm.InstallingPage;
CustomStatusLabel.Caption := 'Test Text';
end;
//procedure CurPageChanged(CurPageID: Integer);
//begin
// M:= TLabel.Create(WizardForm);
//M.Caption:= (ExpandConstant('{cm:FileTemplateDescription}'));
//end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := DataDirPage.Values[0];
end;
function GetFileTemplate(Param: String): String;
begin
// Return values into variables
Result := FileTemplatePage.Values[0];
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\MyApp.ico"; Parameters: "--path:{code:GetDataDir} --filetemplate:{code:GetFileTemplate} --fileconfig:""{app}\conf.yml"""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Parameters: "--path:{code:GetFileTemplate} --filetemplate:{code:GetDataDir} --fileconfig:""{app}\conf.yml"""
我创建了页面FileTemplatePage
,以便用户可以添加文件模板。我想要的是在这个页面上添加一个描述。
环顾四周,我发现了另一个问题。基本上这正是我想要的,但我真的不明白脚本是如何工作的。
如果我添加CurPageChanged(CurPageID: Integer)
程序,我怎么能告诉它改变FileTemplatePage
?我必须把它放在哪里?我不应该把类似的东西放在CurPageChanged(FileTemplatePage.ID)
里面InitializeWizard
吗?
一般来说,我很难理解[Code]
零件的工作原理,难道没有主要功能吗?
我可以编译和使用这个脚本,并且可以将文本可视化到安装页面中,因为Parent
就是这样,我该如何更改Parent
?。
我试图这样做:CustomStatusLabel.Parent := FileTemplatePage
,但我得到了错误Type mismatch
。
你有什么建议吗?谢谢。
解决方案
推荐阅读
- c++ - 用特定值填充数组的边缘
- android-studio - 如何从 android studio 的 makefile 中删除库?
- python - 如何在 Django 中创建一个循环遍历列表中的元素的范围 for 循环
- django - 如何将电子邮件和密码与我保存在 Django 数据库中的电子邮件和密码进行比较
- javascript - 如何使用下面的代码在同一页面上制作多个倒数计时器?
- javascript - react js中如何更新/更改数组中对象的值?
- javascript - 如何通过数据目标和数据值同步两个值?
- json - 为什么应用程序无法通过颤振从 json 文件中获取阿拉伯语单词?
- vba - 图表系列集合 VBA 代码的变更单
- node.js - 如何在对话流中获得回退响应