I agree it would be nice to have this as an option, but you can do it yourself without too much effort.
This code is called in the OnCloseQuery event of the designer. If the report has been modified, it asks if the user wants to save it before exiting. If the report is a new report and no name has been assigned to the template yet, it prompts for a name assuming the user said "Yes" to the "do you want to save it now?" question.
If (ppDesigner.Report.Modified) Then begin MessageBeep(mb_IconExclamation); Btn := MessageDlg('This report has not been saved. Do you want to save it now?', mtConfirmation, [mbYes, mbNo, mbCancel], 0); If (ppReport.Template.DatabaseSettings.Name = EmptyStr) and (Btn = mrYes) Then begin NewRptName := EmptyStr; If (InputQuery('Report Name', 'New Report File Name:', NewRptName) = True) and (Trim(NewRptName) <> EmptyStr) Then begin Btn := mrYes; ppReport.Template.DatabaseSettings.Name := NewRptName; end Else Btn := mrCancel; end; If (Btn = mrYes) Then ppReport.Template.SaveToDatabase; CanClose := (Btn <> mrCancel); end;
Why didn't i think of that..Friday evening, i guess i wasn't focused anymore
This is the code i used, works perfect indeed, thanks.
procedure TFormplanner.DesignerCloseQuery(Sender: TObject; var CanClose: Boolean); Var Res:Byte; begin If Designer.Report.Modified Then Begin Res := MessageDlg('Report is changed, Save now?',mtConfirmation,mbYesNoCancel,0); If Res = MrCancel Then Begin CanClose := False; End Else Begin If Res = mrYes Then Report.Template.SaveToFile; End; End; end;
Comments
yourself without too much effort.
This code is called in the OnCloseQuery event of the designer. If the
report has been modified, it asks if the user wants to save it before
exiting. If the report is a new report and no name has been assigned to the
template yet, it prompts for a name assuming the user said "Yes" to the "do
you want to save it now?" question.
If (ppDesigner.Report.Modified) Then
begin
MessageBeep(mb_IconExclamation);
Btn := MessageDlg('This report has not been saved. Do you want to
save it now?', mtConfirmation, [mbYes, mbNo, mbCancel], 0);
If (ppReport.Template.DatabaseSettings.Name = EmptyStr) and (Btn =
mrYes) Then
begin
NewRptName := EmptyStr;
If (InputQuery('Report Name', 'New Report File Name:', NewRptName)
= True) and (Trim(NewRptName) <> EmptyStr) Then
begin
Btn := mrYes;
ppReport.Template.DatabaseSettings.Name := NewRptName;
end
Else
Btn := mrCancel;
end;
If (Btn = mrYes) Then ppReport.Template.SaveToDatabase;
CanClose := (Btn <> mrCancel);
end;
--
Vinnie Murdico
Software with Brains, Inc.
SWBTracker - Professional Bug Tracking Software
http://www.softwarewithbrains.com
Why didn't i think of that..Friday evening, i guess i wasn't focused anymore
This is the code i used, works perfect indeed, thanks.
procedure TFormplanner.DesignerCloseQuery(Sender: TObject;
var CanClose: Boolean);
Var Res:Byte;
begin
If Designer.Report.Modified Then
Begin
Res := MessageDlg('Report is changed, Save
now?',mtConfirmation,mbYesNoCancel,0);
If Res = MrCancel Then
Begin
CanClose := False;
End Else
Begin
If Res = mrYes Then Report.Template.SaveToFile;
End;
End;
end;
Franky