Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup - Folder to install the software, start menu folder, desktop icon all in the same page

Tags:

inno-setup

How to add them to a single page?

enter image description here

like image 441
Nico Z Avatar asked Oct 19 '25 17:10

Nico Z


1 Answers

  1. For the "Start menu folder" part, the easiest solution is to simply move all the controls from the SelectProgramGroupPage to the SelectDirPage. And of course, shift them all down, below the existing controls.

    You should also shift the original DiskSpaceLabel up, next to other related controls.

    The last step is to update a tab order.

    To hide the real "Select Start Menu Folder" page, use the ShouldSkipPage event function. Had you used the DisableProgramGroupPage=yes, the selected folder won't show on the "Ready to Install" page.

  2. For the "desktop icon", you cannot move the TasksList control, as that is populated only, when the "Select Additional Tasks" page is entered. You have to create your new checkbox. And use the Check parameter to bind the custom checkbox to the Icons section entry.

    To add an information about the "desktop icon" task on the "Ready to Install" page, you have to implement the 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

Of course, I had to make the wizard form higher, to fit all the controls.

like image 196
Martin Prikryl Avatar answered Oct 21 '25 17:10

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!