I'm trying to make a custom checkbox in my custom page (because it's a one page installer), is needed only a checkbox without dialogs or anything, the installer that I'm trying to compile is very linear and simple.
I want to bind FILE3.EXE
on a checkbox in this way: if checkbox is checked copy the file (FILE3.EXE
) in DestDir
, otherwise if checkbox is unchecked skip the file (FILE3.EXE
) during installation.
This is the code that I used, obviously the checkbox code is missing because I'm not able to do that
[Files]
Source: FILE1.EXE; DestDir: {app};
Source: FILE2.EXE; DestDir: {app};
Source: FILE3.EXE; DestDir: {app}; //OPTIONAL
[Code]
procedure ExitProcess(uExitCode: UINT);
external 'ExitProcess@kernel32.dll stdcall';
var
MainPage : TWizardPage;
FolderToInstall : TEdit;
InstallLocation : String;
procedure CancelClick(Sender: TObject);
begin
if ExitSetupMsgBox then
begin
ExitProcess(0);
end;
end;
procedure BrowseClick(Sender : TObject);
var
Dir : String;
begin
Dir := FolderToInstall.Text;
if BrowseForFolder('Browse',Dir,false) then
FolderToInstall.Text := Dir;
WizardForm.DirEdit.Text := Dir;
end;
procedure InitializeWizard();
var
LabelFolder : TLabel;
begin
MainPage := CreateCustomPage(wpWelcome,'','');
LabelFolder := TLabel.Create(MainPage);
LabelFolder.Parent := WizardForm;
LabelFolder.Top := 164;
LabelFolder.Left := 6;
LabelFolder.Caption := 'Directory:'
FolderToInstall := TEdit.Create(MainPage);
FolderToInstall.Parent := WizardForm;
FolderToInstall.Top := 182;
FolderToInstall.Left := 85;
FolderToInstall.Width := 380;
FolderToInstall.Text := WizardDirValue;
FolderToInstall.ReadOnly := True;
end;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…