Modifying an Interface Using the Type Library

From RAD Studio
Jump to: navigation, search

Go Up to Using the Type Library Editor


There are several ways to modify an interface or dispinterface once it is created.

  • You can change the interface's attributes using the page of type information that contains the information you want to change. Select the interface in the Object List pane and then use the controls on the appropriate page of type information. For example, you may want to change the parent interface using the attributes page, or use the flags page to change whether or not it is a dual interface.
  • You can edit the interface declaration directly by selecting the interface in the object list pane and then editing the declarations on the Text page.
  • You can add properties and methods to the interface.
  • You can modify the properties and methods already in your interface by changing their type information.
  • You can associate it with a CoClass by selecting the CoClass in the object list pane, right-clicking in the Implements page, and choosing Insert Interface.

If the interface is associated with a CoClass that was generated by a wizard, you can tell the Type Library Editor to apply your changes to the implementation file by clicking the Refresh button on the toolbar. If you have the Apply Updates Dialog enabled, the Type Library Editor notifies you before updating the sources and warns you of potential problems. For example, if you rename an event interface by mistake, you may get a warning in your source file that looks like this:

Because of the presence of instance variables in your implementation file,
Delphi was not able to update the file to reflect the change in your event
interface name. As Delphi has updated the type library for you, however, you
must update the implementation file by hand.

You also get a TODO comment in your source file immediately above it.

Warning: If you ignore this warning and TODO comment, the code will not compile.

See Also