Get a list of method objects, properties, and events?

When trying to create a new component for which there is no documentation, I need to go through its methods, properties and events in order to try to figure out what it can do. Doing this with the IDE Object Inspector is a bit tedious.

Is there a utility that presents this list in a more readable format?

Thank.

+1
source share
7 answers

When I want to know what something can do, I read the source code . A class declaration will contain a short list of all methods and properties if there is not much inheritance. The definitions will say what you want the methods to do.

- , , Ctrl + Space, Class Completion , .

+3

, . UML. , ( Delphi 2010, RTTI "Uses" ):

procedure DumpProps(aObject: TObject; aList: TStringList);
var
  RttiContext: TRttiContext;
  RttiType: TRttiType;
  I: Integer;
  n: integer;
  props: TArray<TRttiProperty>;

begin
  aList.Clear; //it must be <> nil
  RttiType := RttiContext.GetType(aObject.ClassType);
  props:=RttiType.GetProperties;
  with aList do 
    begin
      Append('');
      Append('==========');
      Append('Begin Dump');
      Append('----------');
      for I := Low(props) to High(props) do
      begin
        try
          Append(props[i].Name+': '); //odd construction to see if the Getter blows
          n:=Count-1;
          Strings[n]:=Strings[n]+props[i].GetValue(aObject).AsString;
        except
          on E: Exception do
            Strings[n]:=Strings[n]+' >>> ERROR! <<< '+E.Message;
        end;
      end;
    end;
end;

, , .

+2

, GExperts.
IDE ModelMaker. .

+1

- " ".

( - ), , .

- Lingua Franca .

+1

.hpp, ++ Builder. Delphi.

0

I just use code completion . If you cannot understand what a component does from the names of properties and methods, then it is probably poorly designed in any case, and you better not use it. Also, since you are asking a question, I assume you have no source. If you do not, I will not use the component. You only save problems for yourself.

0
source

There is RTTI ...

-1
source

All Articles