Вопрос Выбор компонента в зависимости от выбора другого

Статус
В этой теме нельзя размещать новые ответы.

Tolyak26

Новичок
Всем привет. Мне нужно сделать так, что бы инсталлятор не выбирал автоматически компонент при выборе другого компонента. Инсталлятор ругается на то, что я обращаюсь к WizardForm до его создания. Как быть?

Код:
function Mod1Check(): Boolean;
var
  Index: Integer;
begin
      Index := WizardForm.ComponentsList.Items.IndexOf('Mod 2');
      if IsComponentSelected('mods\mod1') then
      begin
        WizardForm.ComponentsList.Checked[Index] := False;
        WizardForm.ComponentsList.ItemEnabled[Index] := False;
      end else begin
        WizardForm.ComponentsList.Checked[Index] := True;
        WizardForm.ComponentsList.ItemEnabled[Index] := True;
      end;
end;

Код:
Name: "mods\mod2"; Description: "Mod 2"; ExtraDiskSpaceRequired: 0; Check: Mod1Check
 

sergey3695

Ветеран
Модератор
Что-то типо этого?
Код:
[Setup]
AppName=Example
AppVerName=Example
DefaultDirName={pf}\Example
DefaultGroupName=Example
OutputDir=.
OutputBaseFilename=Setup

[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: mods; Description: Mod; Types: full; Flags: fixed
Name: mods\mod1; Description: Mod 1; Types: full;
Name: mods\mod2; Description: Mod 2; Flags: fixed

[Code]
procedure Mod1Check(Sender: TObject);
var
  Index: Integer;
begin
  Index := WizardForm.ComponentsList.Items.IndexOf('Mod 2');
if WizardForm.ComponentsList.Checked[WizardForm.ComponentsList.Items.IndexOf('Mod 1')] then
begin
  WizardForm.ComponentsList.Checked[Index] := False;
  WizardForm.ComponentsList.ItemEnabled[Index] := False;
end else
  WizardForm.ComponentsList.ItemEnabled[Index] := True;
end;

procedure InitializeWizard;
begin
  WizardForm.ComponentsList.OnClickCheck:= @Mod1Check;
end;
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху