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

标签 inno-setup

如何将它们添加到单个页面?

enter image description here

最佳答案

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

    您还应该将原始 DiskSpaceLabel 向上移动,靠近其他相关控件。

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

    要隐藏真正的“选择开始菜单文件夹”页面,请使用 ShouldSkipPage event function .你用过DisableProgramGroupPage=yes吗? ,所选文件夹将不会显示在“准备安装”页面上。

  2. 对于“桌面图标”,您不能移动 TasksList 控件,因为它仅在进入“选择其他任务”页面时填充。您必须创建新的复选框。并使用 Check parameter将自定义复选框绑定(bind)到 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;

All on one page

Ready to install

当然,我不得不make the wizard form higher , 以适合所有控件。

关于inno-setup - Inno Setup - 安装软件的文件夹、开始菜单文件夹、桌面图标都在同一页面中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41076777/

相关文章:

command-line-arguments - Inno Setup IDE和ISCC/ISPP传递定义

inno-setup - ArchitecturesAllowed Inno Setup 指令是否涉及 CPU 架构或操作系统架构?

installation - 确定flash OCX是否安装?

json - Inno 安装程序 : How can I edit and retrieve value from a children section of a JSON file

inno-setup - Inno Setup Section [Run] with condition

installation - Inno Installer 安装后不创建子文件夹

inno-setup - Inno Setup - 如何在欢迎页面上放置消息

inno-setup - 为所有用户安装应用程序和数据库

checkbox - 如何根据执行程序/子安装程序的过程结果重新启动 Inno Setup 安装程序

ant - 如何在 javafx-ant、maven 和 INNO 中使用自定义 *.ISS?