Board index » delphi » Component's unit remains in the USES clause...

Component's unit remains in the USES clause...

Hi everyone!

My question is as follows:

I have created a non-visual component that I drop on a form. Then, let's say
I remove the component from the form. Why does the component's unit remain
on the Uses clause ? Is there a way to prevent this so that when the
component is removed from the form its unit gets removed too ?

Thanks in advance

Lina
l...@info-internet.net

 

Re:Component's unit remains in the USES clause...


No. I delete myself all the units not required for compilation
and I will thank Borland if they will allow me (through some
option) to add the units myself and not automatically.

Lucian

Re:Component's unit remains in the USES clause...


On Fri, 14 Sep 2001 16:52:01 -0400, "Lina Scarpellini"

Quote
<l...@info-internet.net> wrote:
> Is there a way to prevent this so that when the component
> is removed from the form its unit gets removed too ?

Nope. Sometimes you'll want a unit included in your uses clause, even
if you don't have a component declared in that unit on your form. For
example, you may be using utility methods from the interface section
of that unit. Or you may wish the unit's initialization section to be
executed on application startup. Because there is no reliable way for
Delphi to automatically sense when to delete units, it doesn't. It is
up to you to keep your source code "clean".
--
Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
  Use Borland servers; posts via others are not seen by TeamB.
  For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:Component's unit remains in the USES clause...


Rick,

What type of memory and/or storage hit do you take when
a unit is declared in the uses clause, but never used?

John

"Rick Rogers (TeamB)" <r...@fenestra.com> wrote in message
news:d415qtk9utrbis16ihemmpr2nrt8ur5v9k@4ax.com...

Quote
> On Fri, 14 Sep 2001 16:52:01 -0400, "Lina Scarpellini"
> <l...@info-internet.net> wrote:

> > Is there a way to prevent this so that when the component
> > is removed from the form its unit gets removed too ?

> Nope. Sometimes you'll want a unit included in your uses clause, even
> if you don't have a component declared in that unit on your form. For
> example, you may be using utility methods from the interface section
> of that unit. Or you may wish the unit's initialization section to be
> executed on application startup. Because there is no reliable way for
> Delphi to automatically sense when to delete units, it doesn't. It is
> up to you to keep your source code "clean".
> --
> Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
>   Use Borland servers; posts via others are not seen by TeamB.
>   For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:Component's unit remains in the USES clause...


On Fri, 14 Sep 2001 20:41:26 -0700, "John Easley"

Quote
<jceas...@earthlink.net> wrote:
>What type of memory and/or storage hit do you take when
>a unit is declared in the uses clause

None, except for initialization sections that get executed once on
application startup. Sometimes the initialization sections can pull in
significant code; see Forms.pas for an example.

But even within this restriction, there is no "extra" cost to include
a unit in multiple uses clauses, just as long as that unit really is
used at least once somewhere in your application.
--
Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
  Use Borland servers; posts via others are not seen by TeamB.
  For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Other Threads