Board index » delphi » Type Library Editor "feature" corrupts code
Bob Liberty
![]() Delphi Developer |
Sat, 18 Jan 2003 03:00:00 GMT
|
Bob Liberty
![]() Delphi Developer |
Sat, 18 Jan 2003 03:00:00 GMT
Type Library Editor "feature" corrupts code
I am writing Automation objects that are derived from a parent object.
These objects all implement the interface that the parent object implements. Whenever I change the type library, Delphi tries to be helpful, and inserts all the code necessary to implement the interface into every derived class. The problem is that the interface is already implemented by the base class, so I don't want all that code duplicated in the rest of the objects. I have to manually remove this code from every file, every time I change my TLB, which is a huge pain. Does anyone know how to turn this feature off, or work around it? Thanks, |
Jure Bogata
![]() Delphi Developer |
Sat, 18 Jan 2003 03:00:00 GMT
Re:Type Library Editor "feature" corrupts codeQuote> The problem is that the interface is already implemented by the base If the interface is already implemented, why should you declare same method in you TLB? It will inherit it from the base class, you don't have to override it. regards, Jure |
Binh L
![]() Delphi Developer |
Sat, 18 Jan 2003 03:00:00 GMT
Re:Type Library Editor "feature" corrupts codeYes this is annoying. However, your problem might be still be solved w/o doing this. See my previous posts on this in the "TypeLib Editor refreshing..." post a couple of weeks ago. have fun Quote"Bob Liberty" <boblibe...@bookofhope.net> wrote in message Quote> I am writing Automation objects that are derived from a parent object. |
Bob Libert
![]() Delphi Developer |
Sun, 19 Jan 2003 03:00:00 GMT
Re:Type Library Editor "feature" corrupts codeThat's not what I'm doing. I did not declare the same method on both objects, or on both interfaces, only on the parent. But, since my derived class implements the parent interface by virtue of inheriting from the base class, Delphi is not smart enough to figure out that the base class already implements the interface, so it adds the declarations and function stubs to my derived class. Quote"Jure Bogataj" <jure.boga...@cis.si> wrote in message Quote> > The problem is that the interface is already implemented by the base |
Bob Libert
![]() Delphi Developer |
Sun, 19 Jan 2003 03:00:00 GMT
Re:Type Library Editor "feature" corrupts codeI read the previous post, but my problem differs in that I am only implementing one interface. I have CoClasses that need to override the base class functionality, but the interface is identical for all. Using the previous example, I would have only the single IPerson interface. My Customer CoClass would also implement IPerson, since it must implement at least one interface. I have no need for an ICustomer interface, so Delphi fills in the stub code for IPerson automatically, even though IPerson is already implemented by the parent object. Sounds like this "feature" can't be turned off. Quote"Binh Ly" <b...@castle.net> wrote in message news:398789d0_2@dnews... |
Binh L
![]() Delphi Developer |
Mon, 20 Jan 2003 03:00:00 GMT
Re:Type Library Editor "feature" corrupts codeOne workaround, is to insert a dummy (useless) interface into the tlb and use that as the default interface in your coclass. Then implement the IPerson interface manually in code. This avoids the refreshing problem. have fun Quote"Bob Liberty" <boblibe...@bookofhope.net> wrote in message Quote> I read the previous post, but my problem differs in that I am only |