Sign in Join
Wiki copytemporary

Testing, if form exists/fr

Deutsch · English · Français

Parfois, une fiche peut être lancée depuis plusieurs endroits dans un programme. Si elle existe déjà, il suffit de la placer en avant-plan, sinon elle doit être créée.

La façon la plus simple est celle-ci :

pascal
if (MyForm = nil) then Application.CreateForm(TMyForm, MyForm);
    MyForm.Show;

Utiliser CloseAction := caFree; dans l'événement OnClose de la fiche.

pascal
procedure TMyForm.Formclose(Sender: Tobject; var Closeaction: Tcloseaction);
    begin
      CloseAction := caFree;
      MyForm := nil;
    End;

Cette méthode provient des discussions dans le forum.

Warning-icon.png

Avertissement: Cette méthode a des limitations :


From the Free Pascal wiki, page "Testing, if form exists/fr", as the Internet Archive kept it on 2025-01-23, last changed on 2020-02-29. 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 .

Edited on wiki.freepascal.org by 2 people, 2016–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
E-ricCreated page
TrevFixed syntax highlighting (minor)

Talk about this page

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