var
BrowseForm1: TSetupForm;
DirTreeView1: TFolderTreeView;
Edit1: TNewEdit;
BrowseBevel,BrowseBevel2,BrowseBevel3: TBevel;
BrowsePanel,BrowsePanel2: TPanel;
procedure DirFolderChange1(Sender: TObject);
begin
if DirTreeView1.Directory <> WizardForm.DirEdit.Text then
begin
Edit1.Text := AddBackslash(DirTreeView1.Directory) + ExpandConstant('{#MyAppName}');
end else begin
Edit1.Text := DirTreeView1.Directory;
end;
end;
procedure BrowseForm_Buttons_OnClick(Sender: TObject);
begin
if Edit1.Text <> WizardForm.DirEdit.Text then WizardForm.DirEdit.Text := Edit1.Text;
end;
procedure BrowseClick(Sender: TObject);
begin
BrowseForm1 := CreateCustomForm();
with BrowseForm1 do
begin
ClientWidth := ScaleX(352);
ClientHeight := ScaleY(388);
Caption := SetupMessage(msgBrowseDialogTitle);
CenterInsideControl(WizardForm, False);
with TLabel.Create(nil) do
begin
SetBounds(ScaleX(12),ScaleY(12),ScaleX(325),ScaleY(15));
Caption := SetupMessage(msgBrowseDialogLabel);
Parent := BrowseForm1;
Font.Size := 8;
end;
BrowseBevel := TBevel.Create(nil)
with BrowseBevel do
begin
SetBounds(ScaleX(0),ScaleY(40),ScaleX(352),ScaleY(2));
Parent := BrowseForm1;
end;
BrowseBevel3 := TBevel.Create(nil)
with BrowseBevel3 do
begin
SetBounds(ScaleX(0),ScaleY(342),ScaleX(352),ScaleY(2));
Parent := BrowseForm1;
end;
BrowsePanel := TPanel.Create(nil)
with BrowsePanel do
begin
SetBounds(ScaleX(5),ScaleY(45),ScaleX(342),ScaleY(292));
Parent := BrowseForm1;
end;
BrowsePanel2 := TPanel.Create(nil)
with BrowsePanel2 do
begin
SetBounds(ScaleX(5),ScaleY(5),ScaleX(332),ScaleY(282));
Parent := BrowsePanel;
BevelOuter := bvLowered;
end;
BrowseBevel2 := TBevel.Create(nil)
with BrowseBevel2 do
begin
SetBounds(ScaleX(5),ScaleY(5),ScaleX(322),ScaleY(272));
Parent := BrowsePanel2;
Style := bsRaised;
end;
DirTreeView1 := TFolderTreeView.Create(nil)
with DirTreeView1 do
begin
SetBounds(ScaleX(10),ScaleY(35),ScaleX(311),ScaleY(235));
OnChange := @DirFolderChange1;
Parent := BrowsePanel2;
end;
Edit1 := TNewEdit.Create(nil);
with Edit1 do
begin
SetBounds(ScaleX(10),ScaleY(10),ScaleX(311),ScaleY(21));
Text := DirTreeView1.Directory;
Parent := BrowsePanel2;
end;
with TButton.Create(nil) do
begin
SetBounds(ScaleX(250),ScaleY(350),ScaleX(88),ScaleY(31));
Parent := BrowseForm1;
Caption := SetupMessage(msgButtonCancel);
ModalResult := mrCancel;
end;
with TButton.Create(nil) do
begin
SetBounds(ScaleX(158),ScaleY(350),ScaleX(88),ScaleY(31));
Parent := BrowseForm1;
Caption := SetupMessage(msgButtonOK);
OnClick := @BrowseForm_Buttons_OnClick;
ModalResult := mrOk;
end;
DirTreeView1.ChangeDirectory(AddBackslash(WizardForm.DirEdit.Text), True);
ShowModal;
Free;
end;
end;
procedure InitializeWizard;
begin
WizardForm.DirBrowseButton.Hide;
with TButton.Create(nil) do
begin
Parent := WizardForm.SelectDirPage;
SetBounds(WizardForm.DirBrowseButton.Left, WizardForm.DirBrowseButton.Top, WizardForm.DirBrowseButton.Width, WizardForm.DirBrowseButton.Height - ScaleY(1));
Caption := SetupMessage(msgButtonBrowse);
OnClick := @BrowseClick;
Cursor := crHand;
end;
end;
[/SPOILER]