[Lazarus] Creating methods using rtti-info

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Feb 2 16:49:37 CET 2013


On Sat, 2 Feb 2013 15:05:51 +0100
Joost van der Sluis <joost at cnoc.nl> wrote:

> > Joost van der Sluis <joost at cnoc.nl> wrote:
> > 
> > > Hi all,
> > > 
> > > I'm writing my own method propertyeditor. And I want it to create the source 
> > for a new method. Only problem is that it should use the RTTI-information to 
> > obtain the method's parameters.
> > > 
> > > Now if I look at TMainIDE.OnPropHookCreateMethod, it does exactly what I want 
> > except that CodeToolBoss.CreatePublishedMethod is called with the 
> > UseTypeInfoForParameters parameter set to false. In my case it has to be true. 
> > ;)
> > 
> > Why?
> > The RTTI might use mediator objects or things from the wrong
> > platform. The codetools use the project sources and that's what
> > the compiler is seeing too.
> 
> Because in my case, there are no events in the project-sources. It's an iOS objective-pascal project. The events for objective-c objects are not defined in the sources/headers, afaik. So it is not possible to adapt the codetools to find them from the sources.
> 
> It's just: event 1 is always onTouchDown, which has one parameter 'id'. (Actually only the amount of parameters is important for Objective-C, but Objective-Pascal also needs the type)

I added a TDesignerMediator.UseRTTIForMethods.
I don't have an example to test it myself.
Please test.

Mattias




More information about the Lazarus mailing list