What’s the difference between Owner and Parent?

Asked

Viewed 81 times

1

I want to know the difference Owner for Parent at Delphi?

  • 1

    Basically Owner is the PARENT and Parent is the CHILD. some components are accurate for an Owner to stay. An example of this is a Tmemo, technically you cannot use it visibly without it having an Owner, in case it would not even appear on the screen.

1 answer

3


The Parent of a Tcontrol is the control that contains it, for example, if three radiobuttons are inside a Groupbox then the Groupbox is their Parent.

Already the Owner indicates the component responsible for releasing that component from the memory

Say, for example, that you create a Tedit in Runtime, and pass the Form as Parent and Owner.

Edt := TEdit.Create(Form1);//Ao fazer isso você está dizendo que quando o Form1 for liberado da memória ele vai liberar o Edt também.
Edt.Parent := Form1;//Ao fazer isso você está dizendo que o Edt está dentro do Form1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.