Главная страница | назад

Article #21519: Items disappearing from the Uses tab in the Type Library editor.


Why are Type Libraries disappearing from the Uses tab in the Type Library editor?


The Delphi type library editor is designed to remove type libraries listed on the Uses tab which are not actually used by the type library currently open. Unfortunately there is a bug with this process which does not account for indirect dependencies. For example, library A uses an interface from library B and library B uses an interface from library C. Library A also has a function with a return type which is defined in C. Because Library A does not explicitly use any interfaces from C, C is removed from the Uses tab, but then subsequently refreshing and compiling a unit which uses library A's pas file, A_TLB.pas, will result in a compiler error along the lines of "Undeclared identifier".

Fortunately there is a simple work around for this. Any type libraries which need to remain on the Uses tab, but are being automatically removed, can be forced to remain by creating a dummy interface which uses an interface from that type library. To do this open your type library and go to the Uses tab. Add the libraries you need. Now create a new interface and call it something like Dummy1. Select a parent interface from the type library you wish to retain. This will force it to remain on the Uses tab. On the Flags tab check 'hidden'. Now refresh and you should be all set.

Last Modified: 11-OCT-00