Kind regards,
Django
The code below assumes you give the user has another way to close the form
(like a TButton).
There is one button on the form (btnClose). If the user presses the X
(close) button on the caption bar, the FormCloseQuery event is fired, and
CanClose will be set to false. If the user presses the btnClose button,
ShouldFormClose will be set to true and the form will be allowed to close.
// Form level variable.
var
ShouldFormClose : boolean = false;
procedure TForm1.btnCloseClick(Sender: TObject);
begin
ShouldFormClose := true;
Close;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := ShouldFormClose;
end;
HTH,
Chris.
-----------
Django Dunn wrote in message ...