Bをチェックするための簡単な実装、Aがチェックされた場合:
[Components]
Name: "A"; Description: "A"
Name: "B"; Description: "B"
[Code]
const
ItemA = 0;
ItemB = 1;
var
PrevItemAChecked: Boolean;
TypesComboOnChangePrev: TNotifyEvent;
procedure ComponentsListCheckChanges;
begin
if PrevItemAChecked <> WizardForm.ComponentsList.Checked[ItemA] then
begin
if WizardForm.ComponentsList.Checked[ItemA] then
WizardForm.ComponentsList.Checked[ItemB] := True;
PrevItemAChecked := WizardForm.ComponentsList.Checked[ItemA];
end;
end;
procedure ComponentsListClickCheck(Sender: TObject);
begin
ComponentsListCheckChanges;
end;
procedure TypesComboOnChange(Sender: TObject);
begin
{ First let Inno Setup update the components selection }
TypesComboOnChangePrev(Sender);
{ And then check for changes }
ComponentsListCheckChanges;
end;
procedure InitializeWizard();
begin
WizardForm.ComponentsList.OnClickCheck := @ComponentsListClickCheck;
{ The Inno Setup itself relies on the WizardForm.TypesCombo.OnChange, }
{ so we have to preserve its handler. }
TypesComboOnChangePrev := WizardForm.TypesCombo.OnChange;
WizardForm.TypesCombo.OnChange := @TypesComboOnChange;
{ Remember the initial state }
{ (by now the components are already selected according to }
{ the defaults or the previous installation) }
PrevItemAChecked := WizardForm.ComponentsList.Checked[ItemA];
end;
は上記Inno Setup ComponentsList OnClick eventに基づいています。
インデックスを使用する代わりに、Inno Setup Uncheck a task when another task is checkedと同様にコンポーネント名と説明を使用することもできます。
OMG! ...初心者の方には簡単ではありませんが、もちろんそれは素晴らしい解決策です – realtebo