On Fri, 23 Jun 2006 00:57:54 +0200 "Darius Blaszijk" <[EMAIL PROTECTED]> wrote:
> Mattias, > > I think you applied the patch wrongly, you did add > > if Result<>'' then > > instead of > > if ResultType<>'' then Right. Stupid identifier completion. Still can't read my thoughts. Fixed. Mattias > > Darius > > > ----- Original Message ----- > From: "Mattias Gaertner" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, June 22, 2006 8:21 PM > Subject: Re: [lazarus] More questions about CodeTools > > > > On Thu, 22 Jun 2006 15:13:54 +0200 (CEST) > > [EMAIL PROTECTED] wrote: > > > >> Yesterday I had a question about how to add a method using CodeTools. I > >> got it working, but I still have a question wether or not I managed to > >> get > >> it to work in the right way. > >> > >> I want to add a published procedure. The type declaration is the > >> following; > >> > >> type TMyMethodType = procedure; > >> > >> the code is added in the following way: > >> > >> CodeToolBoss.CreatePublishedMethod(ACodeBuffer,AClassName,AMethodName, > >> typeinfo(TMyMethodType),true); > >> > >> This actually adds the property but it looks like this; > >> > >> procedure MyProc:; <- notice the colon and semicolon as in a function. > >> > >> I have used the patch added below to get it to work, but I'm in doubt > >> wether or not I'm mistaking here. Should I have done it another way? I > >> believe the patch wouldn't hurt anyway, what is the reason for adding > >':' > + ResultType if ResultType is empty. But as said, perhaps I'm too > >> ignorant > >> to see how it should actually work. > > > > Applied. Thanks. > > > > > >> Another question is, how to create Private methods, is there a way to > >do > it, or do we need a new implementation? > > > > I added a 'CreatePrivateMethod' and added a parameter to the tool > > function. > > > >> > >> Darius > >> > >> > >> Index: eventcodetool.pas > >> =================================================================== > >> --- eventcodetool.pas (revision 9470) > >> +++ eventcodetool.pas (working copy) > >> @@ -199,7 +199,9 @@ > >> SetLength(ResultType,Len); > >> Move(TypeData^.ParamList[Offset],ResultType[1],Len); > >> inc(Offset,Len); > >> - Result:=Result+':'+ResultType; > >> + > >> + if ResultType <> '' then > >> + Result:=Result+':'+ResultType; > >> end; > >> if phpInUpperCase in Attr then Result:=UpperCaseStr(Result); > >> Result:=Result+';'; > > > > > > Mattias > > > > _________________________________________________________________ > > To unsubscribe: mail [EMAIL PROTECTED] with > > "unsubscribe" as the Subject > > archives at http://www.lazarus.freepascal.org/mailarchives > > _________________________________________________________________ > To unsubscribe: mail [EMAIL PROTECTED] with > "unsubscribe" as the Subject > archives at http://www.lazarus.freepascal.org/mailarchives _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
