1

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);
RobeN
  • 5,346
  • 1
  • 33
  • 50
  • I know that I can create custom checkboxes and replace TasksList. But I'm curious if I can simply move TasksList to different WizardPage. – RobeN Mar 01 '13 at 12:52
  • 1
    While you may be able to physically change its container control, you can't move any of the handling of that control to the other page. Your best bet is to customise the existign page, or create one from scratch which then updates the real pages. – Deanna Mar 01 '13 at 13:10
  • Will it be the very same with `Components`? – RobeN Mar 01 '13 at 13:38
  • 1
    If you're going to move or replace any of the built-in controls to a different page, note that you must take care of the checks which are performed at every page change. Thus, if you're replacing a control, you must simulate the control's behavior in every possible way and if you're moving a control, note that it must be placed on the same page or on a page preceding the original control's page (due to those checks). – TLama Mar 01 '13 at 14:03
  • I have a working solution. But it's for how to JOIN two pages. I have joined TasksForm with StartMenuPage without any custom controls. Both [Tasks] and [Icons] works as before. But the problem I was facing was the same as RebeN and it also involves moving controls so it should be helpful here too. Should I post it here as an Answer or create a new question and Answer it? I want to share it, I think it might be useful to many. @TLama what's simulate control's behavior? I moved controls forward,seems ok.Should I expect hidden issues? [link](https://gist.github.com/paponius/d0d10b2d6256e0355c7d) – papo Sep 19 '15 at 01:36
  • @papo, when you press the Next button, the setup reads and stores values from controls of the current page. For example, if you are on the directory selection page, there must be a valid directory entered in the directory edit box on that page. If you'd move that control onto another page, the setup would fill out and use the default directory. – TLama Sep 21 '15 at 07:21
  • @TLama right, that's what I thought and how I understood it. But at least in case of SelectProgramGroupPage (start menu) it will read them later. I put controls from there on to the following SelectTasksPage and it seems to be reading them ok. There is a working sample on that **link** above. – papo Sep 21 '15 at 09:15
  • @papo, check the source before you claim *it's ok* (I didn't, it's on your own risk; the code can change). – TLama Sep 22 '15 at 02:09

1 Answers1

2

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;
RobeN
  • 5,346
  • 1
  • 33
  • 50