unit frmMainU;
interface
uses
frmSettingsU, DatabaseU, VirtualTrees, IniFiles, ....;
type
TfrmMain =
class(TForm)
btnSettings: TButton;
vst: TVirtualStringTree;
procedure btnSettingsClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
database: TMyDatabase;
implementation
{$R *.dfm}
procedure TfrmMain.btnSettingsClick(Sender: TObject);
var
frmSettings: TfrmSettings;
begin
frmSettings := TfrmSettings.Create(
nil);
try
frmSettings.ShowModal;
finally
frmSettings.Free;
end;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
var
ini: TInifile;
begin
database := TMyDatabase.Create;
ini := TIniFile.Create('
settings.ini');
try
database.databasePassword := ini.ReadString('
Database', '
password', '
');
database.databaseName := ini.ReadString('
Database', '
name', '
');
vst.Enabled := ini.ReadBool('
VST', '
enable', true);
finally
ini.Free;
end;
end;
procedure TfrmMain.FormDestroy(Sender: TObject);
begin
database.Free;
end;
end.