type
TDialogType = (dtOpen, dtSave);
procedure Tserver_mainform_form.ExecuteDialog(AOnCanClose: TCloseQueryEvent; AType: TDialogType);
var lOpenDialog : TOpenDialog;
lSaveDialog : TSaveDialog;
begin
case AType
of
dtOpen:
begin
lOpenDialog := TOpenDialog.Create(server_mainform_form);
try
lOpenDialog.DefaultExt := '
xml';
lOpenDialog.Filter := '
XML File / xml|*.xml';
lOpenDialog.Title := '
Datei öffnen...';
lOpenDialog.OnCanClose := AOnCanClose;
lOpenDialog.Options := [ofHideReadOnly,ofFileMustExist,ofEnableSizing];
lOpenDialog.Execute;
finally
lOpenDialog.Free;
end;
end;
dtSave:
begin
lSaveDialog := TSaveDialog.Create(server_mainform_form);
try
lSaveDialog.DefaultExt := '
xml';
lSaveDialog.Filter := '
XML File / xml|*.xml';
lSaveDialog.Title := '
Speichern unter...';
lSaveDialog.OnCanClose := AOnCanClose;
lSaveDialog.Options := [ofOverwritePrompt,ofHideReadOnly,ofEnableSizing];
lSaveDialog.Execute;
finally
lSaveDialog.Free;
end;
end;
end;
// case AType
end;