Inno Setup - Show children component as sibling and show check instead of square in checkbox

前端 未结 1 369
野性不改
野性不改 2021-01-16 03:20

I\'m trying to have a children component to be shown as sibling. I\'m making a installer for a Game which can have multiple versions of the game coexisting in the same inst

相关标签:
1条回答
  • 2021-01-16 03:58

    If I understand your question correctly, you want this layout:

    [Components]
    Name: "game_1";    Description: "Game v1";  Types: full custom
    Name: "game_2";    Description: "Game v2";  Types: full custom
    Name: "com_mods";    Description: "Game Community Mods"; Types: full custom
    Name: "com_mods\3rdmod1"; Description: "Mod 1"; Flags: exclusive
    Name: "com_mods\3rdmod1"; Description: "Mod 2"; Flags: exclusive
    Name: "com_mods\3rdmod1"; Description: "Mod 3"; Flags: exclusive 
    

    But you want to keep the behavior of your current layout.

    Then you have to code the behavior in Pascal Scripting:

    [Code]
    
    const
      Game2Index = 1;
      Game2ModsIndex = 2;
    
    var
      Game2Checked: Boolean;
    
    procedure ComponentsListClickCheck(Sender: TObject);
    var
      ComponentsList: TNewCheckListBox;
    begin
      ComponentsList := WizardForm.ComponentsList;
    
      { If Game 2 got unchecked }
      if Game2Checked and
         (not ComponentsList.Checked[Game2Index]) then
      begin
        { uncheck the mods }
        ComponentsList.Checked[Game2ModsIndex] := False;
      end; 
    
      { If Game 2 mods got checked, make sure Game 2 is checked too }
      if ComponentsList.Checked[Game2ModsIndex] and
         (not ComponentsList.Checked[Game2Index]) then
      begin
        ComponentsList.Checked[Game2Index] := True;
      end; 
    
      Game2Checked := ComponentsList.Checked[Game2Index];
    end;
    
    procedure InitializeWizard();
    begin
      WizardForm.ComponentsList.OnClickCheck := @ComponentsListClickCheck;
    end;
    
    procedure CurPageChanged(CurPageID: Integer);
    begin
      if CurPageID = wpSelectComponents then
      begin
        { Remember the initial state }
        Game2Checked := WizardForm.ComponentsList.Checked[Game2Index];
      end;
    end;
    

    In Inno Setup 6, you can use WizardIsComponentSelected and WizardSelectComponents instead of using indexes.

    0 讨论(0)
提交回复
热议问题