将运行任务显示为无线电选择而不是复选框?

时间:2016-12-28 22:20:57

标签: inno-setup

这是我的脚本的[Run]部分:

[Run]
Filename: "{app}\MeetSchedAssist.exe"; Flags: nowait postinstall skipifsilent runasoriginaluser; Description: "{cm:LaunchProgram,Meeting Schedule Assistant}"
Filename: "{app}\MeetSchedAssist_x64.exe"; Flags: nowait postinstall runasoriginaluser unchecked skipifsilent; Description: "{cm:LaunchProgram,Meeting Schedule Assistant (64 bit)}"; Check: IsWin64
Filename: "{win}\hh.exe"; Parameters: "{app}\MeetSchedAssist.chm::/HelpRevision.htm"; WorkingDir: "{app}"; Flags: nowait postinstall runmaximized; Description: "{cm:ViewChangeHistory}"
Filename: {dotnet40}\regasm.exe; Parameters: PTSTools.dll /codebase; WorkingDir: {app}; Flags: runhidden
Filename: {dotnet4064}\regasm.exe; Parameters: PTSTools.dll /codebase; WorkingDir: {app}; Flags: runhidden; Check: IsWin64;

在安装程序的最后一页上,前三个显示为复选框。

我希望前两个是无线电。他们想要启动一个或另一个位版本。不是两个。

这可能吗?

或者,勾选一个复选框,另一个勾选。

1 个答案:

答案 0 :(得分:2)

您必须根据自己的喜好重新构建RunList

type
  TRunEntry = record
    Caption: string;
    Checked: Boolean;
    Object: TObject;
  end;

procedure RebuildRunList;
var
  RunEntries: array of TRunEntry;
  I: Integer;
begin
  { Save run list ... }
  SetArrayLength(RunEntries, WizardForm.RunList.Items.Count);
  for I := 0 to WizardForm.RunList.Items.Count - 1 do
  begin
    RunEntries[I].Caption := WizardForm.RunList.ItemCaption[I];
    RunEntries[I].Checked := WizardForm.RunList.Checked[I];
    RunEntries[I].Object := WizardForm.RunList.ItemObject[I];
  end;

  { ... clear it ... }
  WizardForm.RunList.Items.Clear;

  { ... and re-create }
  for I := 0 to GetArrayLength(RunEntries) - 1 do
  begin
    { the first two entries are radio buttons }
    if (I = 0) or (I = 1) then
    begin
      WizardForm.RunList.AddRadioButton(
        RunEntries[I].Caption, '', 0, RunEntries[I].Checked, True, RunEntries[I].Object);
    end
      else
    begin
      WizardForm.RunList.AddCheckBox(
        RunEntries[I].Caption, '', 0, RunEntries[I].Checked, True, True, True,
        RunEntries[I].Object);
    end;
  end;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpFinished then
  begin
    { Only now is the RunList populated. }
    { Two entries are on 64-bit systems only. }
    if IsWin64 then RebuildRunList;
  end;
end;

在64位系统上:

Radio buttons in run list

在32位系统上:

enter image description here

当检查另一个复选框时,另一种自动取消选中复选框的方法也是可行的。

查看有关任务列表的类似问题:
Inno Setup Uncheck a task when another task is checked