Inno Setup-用于安装软件的文件夹,开始菜单文件夹,桌面图标均在同一页面上 [英] Inno Setup - Folder to install the software, start menu folder, desktop icon all in the same page
问题描述
如何将它们添加到单个页面中?
How to add them to a single page?
推荐答案
-
对于开始菜单文件夹"部分,最简单的解决方案是将所有控件从
SelectProgramGroupPage
移到SelectDirPage
.当然,将它们全部移到现有控件的下方.
For the "Start menu folder" part, the easiest solution is to simply move all the controls from the
SelectProgramGroupPage
to theSelectDirPage
. And of course, shift them all down, below the existing controls.
您还应该将原始的DiskSpaceLabel
移至其他相关控件旁边.
You should also shift the original DiskSpaceLabel
up, next to other related controls.
最后一步是更新制表符顺序.
The last step is to update a tab order.
要隐藏真正的选择开始菜单文件夹"页面,请使用 ShouldSkipPage
事件功能.如果您使用了 DisableProgramGroupPage=yes
,则所选文件夹将不会显示在准备安装"页面.
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.
对于桌面图标",您无法移动TasksList
控件,因为只有在进入选择其他任务"页面时,该控件才会被填充.您必须创建新的复选框.并使用 Check
参数将自定义复选框绑定到 Icons
部分条目.
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;
当然,我必须将向导窗体设置得更高,以适应所有控件.
Of course, I had to make the wizard form higher, to fit all the controls.
这篇关于Inno Setup-用于安装软件的文件夹,开始菜单文件夹,桌面图标均在同一页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!