installation - 在 Inno Setup 中由 CreateInputQueryPage 创建的页面上的多行编辑

标签 installation inno-setup pascalscript

默认情况下,当您在 Inno Setup 中向页面添加 TEdit 时,高度为一行。

如何增加编辑的高度?

这是 ISS 文件的相关部分

ContractConfigPage := CreateInputQueryPage(ServerConfigPage.ID,
  'Map contract as JSON', 'Please enter the map contract to use in JSON format', '');    
ContractConfigPage.Add('JSON', False);
ContractConfigPage.Edits[0].Height := 100; { does not have any effect }

编辑:我现在可以进行更大的编辑,但不能有多行

ContractConfigPage := CreateInputQueryPage(ServerConfigPage.ID,
  'Map contract as JSON', 'Please enter the map contract to use in JSON format', '');    
ContractConfigPage.Add('JSON', False);
ContractConfigPage.Edits[0].AutoSize := False;
ContractConfigPage.Edits[0].Height := 100;
ContractConfigPage.Edits[0].Width := 100;
{ now the edit is bigger but I still can not have multiple lines }

最佳答案

您必须将 TPasswordEdit 替换为 TNewMemo:

var
  JsonMemo: TNewMemo;

procedure InitializeWizard();
var
  ContractConfigPage: TInputQueryWizardPage;
  JsonIndex: Integer;
  JsonEdit: TCustomEdit;
begin
  { Create new page }
  ContractConfigPage := CreateInputQueryPage(wpWelcome,
    'Map contract as JSON', 'Please enter the map contract to use in JSON format', '');    

  { Add TPasswordEdit. We use it only to have Inno Setup create the prompt label and }
  { to calculate the proper location of the edit control }
  JsonIndex := ContractConfigPage.Add('JSON', False);
  JsonEdit := ContractConfigPage.Edits[JsonIndex];

  { Create TNewMemo (multi line edit) on the same parent control and }
  { the same location (except for height) as the original single-line TPasswordEdit }
  JsonMemo := TNewMemo.Create(WizardForm);
  JsonMemo.Parent := JsonEdit.Parent;
  JsonMemo.SetBounds(JsonEdit.Left, JsonEdit.Top, JsonEdit.Width, ScaleY(100));

  { Hide the original single-line edit }
  JsonEdit.Visible := False;

  { Link the label to the new edit }
  { (has a practical effect only if there were a keyboard accelerator on the label) }
  ContractConfigPage.PromptLabels[JsonIndex].FocusControl := JsonMemo;
end;
<小时/>

现在您无法使用 ContractConfigPage.Edits 访问 TNewMemo 及其值(它引用原始的[隐藏] TPasswordEdit)。您必须使用全局 JsonMemo 变量。

<小时/>

您当然可以完全自己创建页面,使用 CreateCustomPage 从干净的页面开始。这可能是一个更干净的解决方案,但更费力。

关于installation - 在 Inno Setup 中由 CreateInputQueryPage 创建的页面上的多行编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32400937/

相关文章:

wix - 安装程序不卸载文件

blackberry - 黑莓无线安装

installation - Inno setup 中等效的升级代码

drag-and-drop - 如果标题栏被禁用,则使 Inno Setup WizardForm 可移动

registry - 在 Inno Setup 中如何将用户输入保存到注册表?

ios - 有人正在使用新的iOS 11.4.1经历无限的“等待”吗?

bash - "-bash: cd: hadoop: Not a directory"是什么意思?

inno-setup - Inno Setup 不会在PrepareToInstall 部分重新启动

inno-setup - 用 Inno Setup 中 setup 子文件夹中的文件覆盖已安装的文件

iis-7 - 使用 Inno Setup 安装 IIS