问题描述
我希望在我的安装完成页面上有 2 个复选框和两个单选按钮。我从这个 link 中看到,您可以将所有复选框更改为单选按钮,但我如何才能将两者混合使用。
解决方法
我使用了这样的东西:
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 three entries are radio buttons }
if (I = 0) or (I = 1) or (I = 2) then
begin
WizardForm.RunList.AddRadioButton(
RunEntries[I].Caption,'',RunEntries[I].Checked,True,RunEntries[I].Object);
end
else
begin
WizardForm.RunList.AddCheckBox(
RunEntries[I].Caption,RunEntries[I].Object);
end;
end;
end;
它是这样调用的:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
RebuildRunList;
end;
end;
@MartinPrikryl 或许能够找到他在讨论这个问题的地方提供给我的原始答案。