Wednesday, March 2, 2011

Your own object inspector

uses TypInfo;

procedure ObjectInspector(
  Obj   : TObject;
  Items : TStrings );
var
  n        : integer;
  PropList : TPropList;
begin
  n := 0;
  GetPropList(
    Obj.ClassInfo,
    tkProperties + [ tkMethod ],
    @PropList );
  while( (Nil <> PropList[ n ]) and
         (n < High(PropList)) ) do
  begin
    Items.Add(
      PropList[ n ].Name + ': ' +
      PropList[ n ].PropType^.Name );
    Inc( n );
  end;
end;
 

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum