Developer's Guide :: Owner Parent

From Delphi for PHP Documentation Wiki

Jump to: navigation, search

Ownership specifies a relation between two components in which component A owns component B, and B is listed in A->components property, which is a collection or a list.

Parentship specifieds a relation between two controls in which control A holds control B, so visually, B is inside control A and B is listed in A->controls property.

Usually, the owner of all controls/components in a page, is the Page component, and the parent, initially is the Page itself, but you can place components like Panels that hold components inside.

To set a component as the owner of another, you can

 
$newowner=new Component();
$yourcomponent=new Button($newowner);
 

or

 
$newowner=new Component();
$newowner->insertComponent($yourcomponent);
 

Now, $yourcomponent belongs to $newowner, and now, let's see how to create a parent-children relationship.

 
$newparent=new FocusControl();
$yourcomponent->Parent=$newparent;
 
Personal tools