Search code examples
inno-setupwizardcustom-pages

TasksList - how to move TasksList to other WizardForm Page and keep it's content?


When I'm trying to change TasksList's Parent, I get an empty list as the result.

WizardForm.TasksList.Parent := WizardForm.DirEdit.Parent;
WizardForm.TasksList.Top := WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + ScaleY(8);
WizardForm.TasksList.Left := WizardForm.DirEdit.Left;
WizardForm.TasksList.Height := ScaleY(100);

Solution

  • Alternate solution is to create own checkboxes for tasks:

    [Icons]
    Name: "{group}\{#MyAppName1}"; Filename: "{app}\{#MyAppName1}\{#MyAppExeName}"; WorkingDir: "{app}\{#MyAppName1}"; Check: menuicons; Components: G3EE;
    Name: "{group}\{#MyAppName2}"; Filename: "{app}\{#MyAppName2}\{#MyAppExeName2}"; WorkingDir: "{app}\{#MyAppName2}"; Check: menuicons; Components: G3ZBEE;
    Name: "{commondesktop}\{#MyAppName2}"; Filename: "{app}\{#MyAppName2}\{#MyAppExeName2}"; WorkingDir: "{app}\{#MyAppName2}"; Check: desktopicon; Components: G3ZBEE;
    Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName2}"; Filename: "{app}\{#MyAppName2}\{#MyAppExeName2}"; WorkingDir: "{app}\{#MyAppName2}"; Check: quicklaunchicon; Components: G3ZBEE;
    
    [Code]
    Var
    DesktopIconCheckBox: TCheckBox;
    StartMenuCheckBox: TCheckBox;
    QuickStartCheckBox: TCheckBox;
    
    function desktopicon(): Boolean;
    begin
        Result := DesktopIconCheckBox.Checked;
    end;
    
    function menuicons(): Boolean;
    begin
        Result := StartMenuCheckBox.Checked;
    end;
    
    function quicklaunchicon(): Boolean;
    begin
      if GetWindowsVersion < $06000000 then  begin
          Result := QuickStartCheckBox.Checked;
      end;
    end;
    
    procedure InitializeWizard();
    var
      ItemsGap: Integer;
     begin
        ItemsGap := WizardForm.DirBrowseButton.Left - (WizardForm.DirEdit.Left + WizardForm.DirEdit.Width);
        DesktopIconCheckBox := TCheckBox.Create(WizardForm.DirEdit.Owner);
        DesktopIconCheckBox.Visible := true;
        DesktopIconCheckBox.Checked := true;
        StartMenuCheckBox := TCheckBox.Create(WizardForm.DirEdit.Owner);
        StartMenuCheckBox.Visible := true;
        StartMenuCheckBox.Checked := true;
      if GetWindowsVersion < $06000000 then  begin
          QuickStartCheckBox := TCheckBox.Create(WizardForm.DirEdit.Owner);
        QuickStartCheckBox.Visible := true;
          QuickStartCheckBox.Checked := false;  
    end;
        if true then
        begin
        DesktopIconCheckBox.Top := WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + ItemsGap / 2;
        DesktopIconCheckBox.Width := WizardForm.DirEdit.Width;
            DesktopIconCheckBox.Caption := ExpandConstant('{cm:CreateDesktopIcon}');
            DesktopIconCheckBox.Parent := WizardForm.DirEdit.Parent;
            StartMenuCheckBox.Top := DesktopIconCheckBox.Top + DesktopIconCheckBox.Height + ItemsGap / 2;
        StartMenuCheckBox.Width := WizardForm.DirEdit.Width;
            StartMenuCheckBox.Caption := ExpandConstant('{cm:MenuStartIcons}');
            StartMenuCheckBox.Parent := WizardForm.DirEdit.Parent;
          if GetWindowsVersion < $06000000 then  begin
                QuickStartCheckBox.Top := StartMenuCheckBox.Top + StartMenuCheckBox.Height + ItemsGap / 2;
            QuickStartCheckBox.Width := WizardForm.DirEdit.Width;
                QuickStartCheckBox.Caption := ExpandConstant('{cm:CreateQuickLaunchIcon}');//SetupMessage(msgNoProgramGroupCheck2);
                QuickStartCheckBox.Parent := WizardForm.DirEdit.Parent;  
          end;
        end;
    end;