If you set an action in an event FormCloseto caNone, nothing will happen when you try to close the form (by clicking on the red cross). This way you can disable the button.
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := TCloseAction.caNone;
end;
You can find caNone in System.UITypes; read the documentation for more information.
source
share