RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Classes.GetUltimateOwner Function

Returns the top-level owner of a specified persistent object.

Pascal
function GetUltimateOwner(ACollectionItem: TCollectionItem): TPersistent; overload;
function GetUltimateOwner(ACollection: TCollection): TPersistent; overload;
function GetUltimateOwner(APersistent: TPersistent): TPersistent; overload;
C++
TPersistent * GetUltimateOwner(TCollectionItem ACollectionItem);
TPersistent * GetUltimateOwner(TCollection ACollection);
TPersistent * GetUltimateOwner(TPersistent * APersistent);

Left undocumented because it doesn't really do the right thing.  

Call GetUltimateOwner to obtain the ultimate owner of a persistent object. GetUltimateOwner traverses the ownership hierarchy, finding first the Owner, and then that Owner's Owner, and so on, until there are no more owners.  

The ultimate owner is typically the form or data module that contains the object instance. However, if one of the Owners (other than a form or data module) does not have an Owner, GetUltimateOwner returns nil (Delphi) or NULL (C++).  

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!