Delphi What is the MainForm Property in DelphiVCL.Application?

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,203
Credits
4,034
What is the MainForm Property in DelphiVCL.Application?
By Muhammad Azizul Hakim September 27, 2021

The MainForm or DelphiVCL.Application.MainForm property identifies the form in the application that is the main form.

The value of MainForm is the form that is the application’s main window. The main form is the first form created in the main body of the application by a call to CreateForm. When the main form closes, the application terminates. MainForm cannot be modified at run time (it is read-only at run time).

What else is there to know about DelphiVCL.Application.MainForm?​

Note: By default, the form created by the first call to CreateForm in a project becomes the application’s main form. Before calling CreateForm, you can create as many forms as wanted by calling their own constructor.

Note: Before showing the MainForm, you can add a splash window. The MainForm will be shown after the initialization of the application finishes.

Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.MainForm using dir() command:

Python:
import DelphiVCL
 
dir(DelphiVCL.Application.MainForm)

What does the output of the MainForm example look like?​

See the responses in our Windows command prompt:
1632739323404.png
You can also read short information about the DelphiVCL.Application.MainForm using the print() command:
Python:
print(DelphiVCL.Application.MainForm)
print(DelphiVCL.Application.MainForm.__doc__)
See the responses in our Windows command prompt:
1632739429008.png