Object Inspector • TPropertyInterface


TPropertyInterface component allows to access any property and event of any component at runtime.

Main features:

  • Full information about each property through special TProperty class
  • Easy access property value by special properties (AsString, AsInteger, etc.)
  • Finding property by name and full name
Example of using:
uses ..., TypInfo, PropList, PropIntf;

var
  i: Integer;
  P: TProperty;

begin
  with PropertyInterface do
  begin
    Root:=Self;
    Instance:=Edit;
    // finding property by name
    P:=FindProperty('Color');
    if Assigned(P) then P.AsInteger:=clRed;
    // finding property by full name
    P:=FindProperty('Font.Style.fsBold');
    if Assigned(P) then P.AsBoolean:=True;
    // setting all Boolean properties to True
    for i:=0 to Pred(Count) do
      if Properties[i].PropType=TypeInfo(Boolean) then
        Properties[i].AsBoolean:=True;
  end;
end;