#define GameName "Sacred"
[Setup]
AppName={#GameName}
AppVerName={#GameName}
DefaultDirName={pf}\{#GameName}
OutputDir=.
AppPublisher=troyan
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[_Code]
var
BrowseForm : TSetupForm;
Browse, OK, NO, back, new : TButton;
DirTreeView : TFolderTreeView;
Edit : TNewEdit;
//-----------------------------//
procedure OKclick(Sender: TObject);
begin
BrowseForm.Close;
WizardForm.Enabled:=True;
WizardForm.DirEdit.Text:=AddBackslash(Edit.Text);
end;
procedure BackClick(Sender: TObject);
begin
Edit.Text:=AddBackslash(ExpandConstant('{pf}\')+'{#GameName}');
DirTreeView.ChangeDirectory(AddBackslash(ExpandConstant('{pf}\')), True);
end;
procedure NewClick(Sender: TObject);
begin
DirTreeView.CreateNewDirectory('Новая');
Edit.Text:=AddBackslash(DirTreeView.Directory) + '{#GameName}';
end;
procedure NOclick(Sender: TObject);
begin
BrowseForm.Close;
WizardForm.Enabled:=true;
end;
procedure DirFolderChange(Sender: TObject);
Begin
Edit.Text:=AddBackslash(DirTreeView.Directory) + '{#GameName}';
end;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
begin
WizardForm.Enabled:=true;
end;
//-----------------------------//
procedure BrowseClick(Sender: TObject);
begin
BrowseForm := CreateCustomForm();
with BrowseForm do begin
ClientWidth:=WizardForm.Width/2;
ClientHeight:=WizardForm.Height-100;
CenterInsideControl(WizardForm, False);
Caption:='Browse For Folder';
Color:=$3E2536;
onClose:=@FormClose;
ok:=tbutton.create(BrowseForm)
with ok do begin
Left:=5; top:=BrowseForm.Height-ok.Height-30;
Width:=BrowseForm.ClientWidth/4;
parent:=BrowseForm;
Caption:='OK';
onclick:=@OKclick;
end;
back:=tbutton.create(BrowseForm)
with back do begin
Left:=ok.left+ok.Width+5; top:=BrowseForm.Height-ok.Height-30;
Width:=BrowseForm.ClientWidth/5;
parent:=BrowseForm;
Caption:='Reset';
onclick:=@BackClick;
end;
new:=tbutton.create(BrowseForm)
with new do begin
Left:=back.left+back.Width+7; top:=BrowseForm.Height-ok.Height-30;
Width:=BrowseForm.ClientWidth/5;
parent:=BrowseForm;
Caption:='Folder';
onclick:=@NewClick;
end;
no:=tbutton.create(BrowseForm)
with no do begin
Width:=BrowseForm.ClientWidth/4;
Left:=BrowseForm.ClientWidth - Width -5; top:=BrowseForm.Height-ok.Height-30;
parent:=BrowseForm;
Caption:='NO';
onclick:=@NOclick;
end;
DirTreeView:= TFolderTreeView.Create(BrowseForm)
with DirTreeView do begin
SetBounds(5,5,BrowseForm.Width-17,210);
OnChange:=@DirFolderChange;
Parent:=BrowseForm;
end;
Edit:= TNewEdit.Create(BrowseForm);
with edit do begin
SetBounds(5,220,BrowseForm.Width-17,15);
Text:=WizardForm.DirEdit.text;
Parent:= BrowseForm;
Color:=$3E2536;
Font.Color:=clWhite;
Font.Name:='Georgia';
end;
with tlabel.create(BrowseForm) do begin
SetBounds(6,245,BrowseForm.Width,15);
caption:='Select a folder and click OK, else click NO.';
parent:=BrowseForm;
Font.Color:=clWhite;
Font.Size:=8;
Font.Name:='Georgia';
end;
end;
DirTreeView.ChangeDirectory(AddBackslash(WizardForm.dirEdit.Text), true);
Edit.Text:=AddBackslash(DirTreeView.Directory);
BrowseForm.Show;
WizardForm.Enabled:=false;
end;
//-----------------------------//
procedure InitializeWizard;
begin
WizardForm.DirBrowseButton.Visible:=false;
Browse:=tbutton.create(WizardForm);
with Browse do begin
Parent:=WizardForm.SelectDirPage;
Left:=WizardForm.DirBrowseButton.left;
Top:=WizardForm.DirBrowseButton.Top-1;
Caption:='My Browse...';
OnClick:=@BrowseClick;
end;
end;