formhook OnFormCloseButtonClick event
Return to Introduction  Previous page  Next page
Applies to
acFormHook component.  

Declaration
type  
  TacFormCloseButtonClickEvent = procedure(Sender: TObject; var AllowClose: Boolean) of object;  
 
property OnFormCloseButtonClick: TacFormCloseButtonClickEvent;  

Description
The OnFormCloseButtonClick event occurs when user clicks the close [X] button on the form's title bar.  
 
Use AllowClose parameter to allow or prevent closing of the form on clicking the X button. Set it to True to allow close form or to False to disallow.  

Example (demonstrates how to minimize the form to tray icon instead of closing it)
procedure TMainForm.acFormHook1FormCloseButtonClick(Sender: TObject;  
  var AllowClose: Boolean);  
begin  
  AllowClose := False;  
  acTrayIcon1.MinimizeToTray;  
end;