Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
690 views
in Technique[技术] by (71.8m points)

inno setup - Showing run tasks as radio choices instead of check boxes?

This is the [Run] section of my script:

[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}
egasm.exe; Parameters: PTSTools.dll /codebase; WorkingDir: {app}; Flags: runhidden
Filename: {dotnet4064}
egasm.exe; Parameters: PTSTools.dll /codebase; WorkingDir: {app}; Flags: runhidden; Check: IsWin64;

On the final page of the installer the first three show as check boxes.

I would like the first two to be radios. They will want to start one or the other bit edition. Not both.

Is this possible?

Or, as one check box is ticked the other gets unticked.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You would have to re-build the RunList according to your liking.

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;

On 64-bit system:

Radio buttons in run list

On 32-bit system:

enter image description here


The other approach with automatically unchecking check box, when the other one is checked, is possible too.

See these similar questions:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...