inno-setup – Inno Setup – 在同一页面中安装软件,开始菜单文件夹,桌面图标的文件夹

前端之家收集整理的这篇文章主要介绍了inno-setup – Inno Setup – 在同一页面中安装软件,开始菜单文件夹,桌面图标的文件夹前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何将它们添加到单个页面

解决方法

>对于“开始菜单文件夹”部分,最简单的解决方案是将所有控件从SelectProgramGroupPage移动到SelectDirPage.当然,将它们全部向下移动,低于现有控件.

您还应该将原始DiskSpaceLabel向上移动到其他相关控件旁边.

最后一步是更新Tab键顺序.

要隐藏真实的“选择开始菜单文件夹”页面,请使用ShouldSkipPage event function.如果您使用了DisableProgramGroupPage=yes,则所选文件夹将不会显示在“准备安装”页面上.
>对于“桌面图标”,当输入“选择其他任务”页面时,无法移动任务列表控件,因为它仅填充.您必须创建新的复选框.并使用Check parameter自定义复选框绑定到Icons section entry.

要在“准备安装”页面添加有关“桌面图标”任务的信息,您必须实现UpdateReadyMemo event function

[Setup]
DisableProgramGroupPage=no
AllowNoIcons=yes

[Icons]
Name: "{userdesktop}\My Program"; Filename: "{app}\MyProg.exe"; \
    Check: ShouldCreateDesktopIcon

[Code]
var
  DesktopCheck: TNewCheckBox;

function ShouldCreateDesktopIcon: Boolean;
begin
  Result := DesktopCheck.Checked;
end;

procedure InitializeWizard();
var
  Offset: Integer;
begin
  { shift the original `DiskSpaceLabel` up,next to the other related controls }
  WizardForm.DiskSpaceLabel.Top := WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + ScaleY(16);

  { Move all the controls from the `SelectProgramGroupPage` to the `SelectDirPage`. }
  { And shift them all down,below the existing controls. }
  { Update tab order. }
  Offset := WizardForm.DiskSpaceLabel.Top + WizardForm.DiskSpaceLabel.Height + ScaleY(16) - WizardForm.SelectGroupBitmapImage.Top;
  WizardForm.SelectGroupBitmapImage.Parent := WizardForm.SelectDirPage;
  WizardForm.SelectGroupBitmapImage.Top := WizardForm.SelectGroupBitmapImage.Top + Offset;
  WizardForm.SelectStartMenuFolderLabel.Parent := WizardForm.SelectDirPage;
  WizardForm.SelectStartMenuFolderLabel.Top := WizardForm.SelectStartMenuFolderLabel.Top + Offset;
  WizardForm.SelectStartMenuFolderBrowseLabel.Parent := WizardForm.SelectDirPage;
  WizardForm.SelectStartMenuFolderBrowseLabel.Top := WizardForm.SelectStartMenuFolderBrowseLabel.Top + Offset;
  WizardForm.GroupEdit.Parent := WizardForm.SelectDirPage;
  WizardForm.GroupEdit.Top := WizardForm.GroupEdit.Top + Offset;
  WizardForm.GroupEdit.TabOrder := WizardForm.GroupEdit.TabOrder + 100;
  WizardForm.GroupBrowseButton.Parent := WizardForm.SelectDirPage;
  WizardForm.GroupBrowseButton.Top := WizardForm.GroupBrowseButton.Top + Offset;
  WizardForm.GroupBrowseButton.TabOrder := WizardForm.GroupBrowseButton.TabOrder + 100;
  WizardForm.NoIconsCheck.Parent := WizardForm.SelectDirPage;
  WizardForm.NoIconsCheck.Top := WizardForm.GroupEdit.Top + WizardForm.GroupEdit.Height + ScaleY(16);
  WizardForm.NoIconsCheck.TabOrder := WizardForm.NoIconsCheck.TabOrder + 100;

  { create new "Create a desktop icon" checkBox }
  DesktopCheck := TNewCheckBox.Create(WizardForm);
  DesktopCheck.Parent := WizardForm.SelectDirPage;
  DesktopCheck.Top := WizardForm.NoIconsCheck.Top + WizardForm.NoIconsCheck.Height + ScaleY(6);
  DesktopCheck.Width := WizardForm.NoIconsCheck.Width;
  DesktopCheck.Height := WizardForm.NoIconsCheck.Height;
  DesktopCheck.Caption := ExpandConstant('{cm:CreateDesktopIcon}');
  DesktopCheck.TabOrder := 200;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  { To hide the real "Select Start Menu Folder" page }
  Result := (PageID = wpSelectProgramGroup);
end;

function UpdateReadyMemo(
  Space,NewLine,MemoUserInfoInfo,MemoDirInfo,MemoTypeInfo,MemoComponentsInfo,MemoGroupInfo,MemoTasksInfo: String): String;
var
  S: string;
begin
  if Length(MemoUserInfoInfo) > 0 then
    Result := Result + MemoUserInfoInfo + NewLine + NewLine;

  if Length(MemoDirInfo) > 0 then
    Result := Result + MemoDirInfo + NewLine + NewLine;

  if Length(MemoTypeInfo) > 0 then
    Result := Result + MemoTypeInfo + NewLine + NewLine;

  if Length(MemoComponentsInfo) > 0 then
    Result := Result + MemoComponentsInfo + NewLine + NewLine;

  if Length(MemoGroupInfo) > 0 then
    Result := Result + MemoGroupInfo + NewLine + NewLine;

  if DesktopCheck.Checked then
  begin
    S := DesktopCheck.Caption;
    StringChange(S,'&',''); 
    Result :=
      Result + SetupMessage(msgReadyMemoTasks) + NewLine +
      Space + S + NewLine + NewLine;
  end;  
end;

当然,我必须在make the wizard form higher,以适应所有控件.

原文链接:https://www.f2er.com/delphi/103140.html

猜你在找的Delphi相关文章