- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Differences between Create(Self) and Create(Application)

Question:

What's the difference between TForm.Create(Self) and TForm.Create(Application)?

Answer:

Self is an implicit variable which can only be used within class
methods, and refers to the current class instance. So "Self" within a
method of the TForm1 class refers to the current instance of TForm1.

When you create a form or component, you pass its owner in the
constructor. When a form or component is freed, it automatically frees
all the components which it owns as well.

So if you pass an Application as the owner when you create a form
instance, the form instance will be automatically freed when the
Application is freed.

If you pass a form instance as the owner when you create another form
instance, the second form will be freed when the first is freed.



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile