Board index » delphi » Type Library Editor "feature" corrupts code

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,
Bob L.

 

Re:Type Library Editor "feature" corrupts code


Quote
> 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
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

Re:Type Library Editor "feature" corrupts code


Yes 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
--
Binh Ly
http://www.techvanguards.com

Quote
"Bob Liberty" <boblibe...@bookofhope.net> wrote in message

news:3987380f_1@dnews...
Quote
> 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,
> Bob L.

Re:Type Library Editor "feature" corrupts code


That'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

news:39873a41_2@dnews...
Quote
> > 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
> 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

Re:Type Library Editor "feature" corrupts code


I 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...
> Yes 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
> --
> Binh Ly
> http://www.techvanguards.com

> "Bob Liberty" <boblibe...@bookofhope.net> wrote in message
> news:3987380f_1@dnews...
> > 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,
> > Bob L.

Re:Type Library Editor "feature" corrupts code


One 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
--
Binh Ly
http://www.techvanguards.com

Quote
"Bob Liberty" <boblibe...@bookofhope.net> wrote in message

news:39885890_2@dnews...
Quote
> I 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.

> "Binh Ly" <b...@castle.net> wrote in message news:398789d0_2@dnews...
> > Yes 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
> > --
> > Binh Ly
> > http://www.techvanguards.com

> > "Bob Liberty" <boblibe...@bookofhope.net> wrote in message
> > news:3987380f_1@dnews...
> > > 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,
> > > Bob L.

Other Threads