1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
procedure TForm1.GetObjectInfo(Objet: TObject);
var
PData : PTypeData;
PListe : PPropList;
NbProps,
I : Integer;
Method : TMethod;
iPosGrid : integer;
begin
PData := GetTypeData(PTypeInfo(Objet.ClassInfo));
NbProps := PData^.PropCount;
New(PListe);
GetPropInfos(PTypeInfo(Objet.ClassInfo), PListe);
SortPropList(PListe,NbProps);
with StringGrid1 do
begin
ColCount := 3;
RowCount := NbProps + 1;
for i := 0 to RowCount -1 do
Cells[1,i] := '';
iPosGrid := 1;
for I := 0 to NbProps -1 do
begin
if PListe^[I]^.PropType^.Kind <> tkMethod then
begin
Cells[0,iPosGrid] := PListe^[I]^.Name;
Cells[2,IposGrid] := PListe^[I]^.PropType^.Name;
case PListe^[I]^.PropType^.Kind of
tkInteger: begin
if UpperCase(PListe^[I]^.PropType^.Name) = 'TCOLOR' then
Cells[1,iPosGrid] := IntToHex(GetOrdProp(Self, PListe^[I]),6)
else
Cells[1,iPosGrid] := IntToStr(GetOrdProp(Self, PListe^[I]));
end;
tkString,tkWString,tkLString :
Cells[1,iPosGrid] := GetStrProp(Self, PListe^[I]);
tkFloat :
Cells[1,iPosGrid] := FormatFloat('0.0000000',GetFloatProp(Self, PListe^[I]));
tkEnumeration : begin
if UpperCase(PListe^[I]^.PropType^.Name) = 'BOOLEAN' then
Case GetOrdProp(Self, PListe^[I]) of
0: Cells[1,iPosGrid] := 'False';
1: Cells[1,iPosGrid] := 'True';
else
Cells[1,iPosGrid] := 'Inconnue';
end;
end;
{tkMethod :
begin
Method := GetMethodProp(Self, PListe^[I]);
if Method.Code <> NIL then
Cells[1,i+1] := ' (' +
TObject(Method.Data).MethodName(Method.Code) + ')';
end;}
tkUnknown:
Cells[1,iPosGrid] := 'Inconnue';
end; // case
inc(iPosGrid);
end
else
RowCount := RowCount -1;
end;// if
end;
Dispose(PListe);
end; |
Partager