[lazarus] Using RTTI to get properties and methods

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Mon Feb 5 16:49:27 EST 2001




On Mon, 5 Feb 2001, Shane Miller wrote:

> I'm not familiar with this stuff ata all so I'm a bit over my head so bear with me.
> 
> You guys are saying that I should create some browser database that I could reference for the classes in the LCL and the current unit that's loaded and then run through that for the code completion?
> 
> I was planning on just compiling the unit with browser information then parsing the browser.log file for the information I need.  However, that' going to be tough because I can find the 
> ***FORM1***
>  (or whatever they typed and then pressed the period).  Then I have to parse the source to find out what FORM1 is a declaration of!
> 
> That isn't terribly easy because there could be comments or whatever 
> between the text FORM1 and the text TFORM1.
> 
> Is parsing the browser.log file the way to go?  
> If not, please explain the other options a bit more.  
> I'm not sure what you guys mean when you say I should 
> build a browser database.  During runtime?  ????

Yes. Delphi itself compiles (!!) the current unit you're working on behind
the scenes; that is why if your code contains errors, the code completion
doesn't work in Delphi; it also explains why at certain times it seems to
be working very hard when you're not doing anything at all.

At those times it recompiles the current unit (and other units it needs),
to be able to extract browser info...

The only time when they actually parse the current unit in the IDE is when 
they do  the class completion (CTRL-SHIFT-C) (obviously, since then they 
cannot compile it, as it's not complete)

The best way would be to keep browser log files of all units somewhere,
and use those for the code completion. From time to time these could be
updated.

Michael.

> 
> Shane
> 
> 
> 
> >>> Michael.VanCanneyt at wisa.be 02/05/01 02:27PM >>>
> 
> 
> On Mon, 5 Feb 2001, Peter Vreman wrote:
> 
> > 
> > >>PT := GetTypeData(Form1.ClassInfo)
> > >>
> > >>Pt only reflects the published properties and methods.  Is there a way to 
> > >>get the other methods or am I doing this wrong?
> > >
> > >Not with RTTI.
> > >
> > >>Should I be using something else to implement code completion?
> > >
> > >Yes, the browser info. Maybe have a look at the implementation
> > >of browser info in the text mode IDE. The important files for
> > >browser implementation are:
> > >
> > >ide/text/fpsymbol.pas
> > >compiler/browcol.pas
> > >compiler/browlog.pas
> > >
> > >Afaik the disadvantage is that the current implementation needs parts of 
> > >the compiler (symtable etc.).
> > >The browser.log generated by the switch -bl isn't very helpful.
> > >
> > >If you need more info, Pierre or Peter may help.
> > 
> > A way to be independent of the compiler is to create a browser database 
> > file that lazarus then can load. MSDev does it also that way. The IDE 
> > should also keep track of the line number changes made by insertion or 
> > deletion.
> 
> I think this is actually the only way you can do it, without including
> the compiler in the IDE, and I don't think that doing that is a good idea.
> 
> Michael.
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus
> 






More information about the Lazarus mailing list