0

When I want to create a TComponent descendent using the Create method in delphi we must pass a parameter :

className.Create(AOwner)

where AOwner is of type TComponent

From what i know it accepts any one of three parameter(in default create cases)

Nil,Self, application 

I did't quite understood when to use which.

Can someone please elaborate on same.

J...
  • 30,968
  • 6
  • 66
  • 143
  • It depends on the class. Which class are you asking about. They can all be different. Are you specifically talking about descendents of `TComponent`? – J... Jan 28 '20 at 18:44
  • Thanks for the response. Yes TComponent specifically – Arpit Mishra Jan 28 '20 at 18:45
  • 1
    Also depends on context.. Did you read the [docs](http://docwiki.embarcadero.com/Libraries/en/System.Classes.TComponent.Owner) already? Also [this](http://docwiki.embarcadero.com/Libraries/Rio/en/System.Classes.TComponent.Create). – Sertac Akyuz Jan 28 '20 at 18:53
  • Also you can search for and find similar questions, like [this](https://stackoverflow.com/questions/474448/why-do-some-delphi-components-require-aowner-tcomponent-to-construct-them) one. – Sertac Akyuz Jan 28 '20 at 18:55
  • 3
    Or, my standard advice: by reading a good book about Delphi programming, you learn how the language works and you get the big picture combined with the subtle details. It is much harder to truly learn a new language by simply googling one particular issue at a time. Much harder. – Andreas Rejbrand Jan 28 '20 at 22:20

0 Answers0