Sign in Join
Wiki copytemporary

user should not be able to close form/fr

Deutsch · English · Français

Vous pouvez utiliser l'événement OnCloseQuery de la fiche pour notifier quand la fiche va être fermée. Commencez par ajouter dans le gestionnaire à partir de l'inspecteur d'objets. La variable CanClose détermine s'il faut (valeur true) ou non (valeur false) quitter la fiche. Mettre CanClose à false empêche la sortie de la fiche (par exemple pour obliger la validation ou l'annulation d'une saisie), c'est une assez mauvaise idée car cela bloque définitivement le programme.

Dans l'exemple ci-dessous, il est interdit de sortir de la fiche si rien n'est saisi dans le contrôle d'édition Edit1.

Example:

pascal
uses
  Forms, ...;
  
  ...
  
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin 
  CanClose := (Length(Edit1.Text) > 0); 
end;
  
  ...

From the Free Pascal wiki, page "user should not be able to close form/fr", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.