|
How to use Property Interface?
TPropertyList (main class of the Property Interface) has two key properties: Instance and Root. The Instance property points to the object instance and the Root property point to the root component. The root is used for conversion between method names and method addresses. Usually Root must point to the form. To use TPropertyList just create the instance of this class and assign the Instance and Root properties. After it the published interface of the assigned Instance can be available through TPropertyList's properties.
procedure TForm1.FormClick(Sender: TObject);
begin
with TPropertyList.Create(nil) do
try
Instance:=Self;
Root:=Self;
ShowMessage(Format('Properties count: %d',[Count]));
ShowMessage(Format('First property: %s',[Properties[0].Name]));
finally
Free;
end;
end;
TPropertyList contains the information about property count and allow to find the property by name, all needed information about each property can be obtained by TProperty class. TProperty is contained in the Properties array and is retured by FindProperty method of TPropertyList class.
|