Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2000-04

i'm confused...

4 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Florian Klaempfl
to dvortex: Hey guys.. can someone explain me how to use the GetPropList stuff ? I don't quite grab…
dvortex wrote 21 lines
Hey guys.. can someone explain me how to use the GetPropList stuff ? I don't quite grab the principle of it. when i first looked at it, i though i would just pass an object to it (or something like that) and that it would return some list of pointers to different properties and methods ?!? now it doesn't make sense to me... is it just a matter of having: -----8<-----8<----- var tempPropInfo: TPropInfo; tempPropList: TPropList; [...] { we want to inspect a class} tempPropInfo.DataKind := dtTClass; { the instance that is called "Object1" } tempPropInfo.Name := 'Object1';

You've to do something like:

var
   pi : ptypeinfo;
   pp : pproplist;
   pt : ptypedata;
   pri : ppropinfo;
begin
   pi:=o.classinfo;  { o is the class you want to inspect }
   pt:=gettypedata(pi);
   getmem(pp,pt^.propcount*sizeof(pointer));
   getpropinfos(pi,pp);
   // Now you can play with pp:
   for i:=0 to pt^.propcount-1 do
     begin
        pri:=pp^[i];
        case pri^.proptype^.kind of
           tkfloat:
             writeln('Value of: ',pri^.name,GetFloatValue(o,pri));
     ...

I'll send our test program for rtti to your private email (everybody can get it doing
cvs checkout tests
(it's the file tests\test\testrtti.pp)
I think it's a very good example about using rtti.

If you've still questions, feel free to ask, I coded most of FPCs rtti stuff.

Reply by email

dvortex

Hey guys.. can someone explain me how to use the GetPropList stuff ? I don't quite grab the principle of it.

when i first looked at it, i though i would just pass an object to it (or something like that) and that it would return some list of pointers to different properties and methods ?!? now it doesn't make sense to me...

is it just a matter of having:

-----8<-----8<-----
var
  tempPropInfo: TPropInfo;
  tempPropList: TPropList;

[...]

{ we want to inspect a class}
  tempPropInfo.DataKind := dtTClass;
{ the instance that is called "Object1" }
  tempPropInfo.Name := 'Object1';
  GetPropInfos( @TempPropInfo, @tempPropList);

-----8<-----8<-----
and then play with tempPropList ?

Is that corrent ?
(if it is, then i am not far from having something working .. need some testing now, but should be there :o)

I gave up on the "load/save XML for now". i want to have the inspector part working as soon as possible, and i'm sure that between me and you, we will be able to wipe this in a couple days :o)

ok, waiting for the answer on that and i'll be working on that tomorow.

Thanks.

Reply by email