Re: save when close


[ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by WAllison on January 02, 2002 at 19:54:54:

In Reply to: save when close posted by JiiPee on January 02, 2002 at 01:46:02:

: I wonder how can I put the exe program save the changes if you have example changed edit text when you close? when you close the (form) exe file the changes will save. or example by clickin a button. I need just a simple code!

: Thanx!

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose := Edit1.Modified;
end;

if u use multiple controls - use a var (boolean) in the private section - set it to false when the form is created or a new file is opened etc - set it to true whenever a control is modified(OnChangeEvent)
Then do CanClose := the variable in private section


[ DelphiLand FAQ ] [ Delphi Tutorials ]