Sign in Join
Wiki copytemporary

Testing, if form exists/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Testing, if form exists/de

OldNewLine
1+Manchmal kann eine [[TForm/de|Form]] von mehreren Stellen in einem Programm gestartet werden. Wenn sie bereits vorhanden ist, muss sie nur nach vorn gebracht werden. Wenn nicht, muss sie erstellt werden.
2+
3+Diese Methode wird nur benötigt, wenn die Form [[Form Tutorial/de|nicht automatisch erstellt]] wird (es sollte aber unter Hauptmenü -\> Projekt -\> Formulare zu finden sein).
4+
5+Der einfachste Weg ist:
6+
7+``` pascal
8+if (MyForm = nil) then Application.CreateForm(TMyForm, MyForm);
9+MyForm.Show;
10+```
11+
12+Verwenden Sie Closeaction: = caFree in OnClose-Ereignis des Formulars z.B so:
13+
14+``` pascal
15+procedure TMyForm.Formclose(Sender: Tobject; var Closeaction: Tcloseaction);
16+begin
17+ CloseAction := caFree;
18+ MyForm := nil;
19+End;
20+```
21+
22+---
23+*From the Free Pascal wiki, page "Testing, if form exists/de", as it stood on 2020-02-29 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](/wiki-contact).*

Back to history