Type Library Editor Window

From RAD Studio
Jump to: navigation, search

Go Up to View Menu

View > Type Library

Enables you to examine and make changes to a type library. A new feature for 2009 is the addition of a new file type for type libraries: the .ridl file. The Type Library Editor displays and saves type libraries in the proprietary text-based format known as RIDL (Restricted Interface Definition Language). When you create a COM object, the Type Library Editor automatically generates the required RIDL syntax. Any changes you make in the editor are reflected in the corresponding implementation class (if it was created using a wizard). The type library is also saved as a .tlb file when you build or save your project

The View > Type Library command is available only for projects that contain a type library. The various COM-related wizards on the ActiveX page automatically add a type library to the project when they create a COM object.

A type library that is created by the wizards on the ActiveX page is represented in the Project Manager as a .ridl file. You can double-click the .ridl file to open the Type Library Editor. To view a .tlb file (such as one created outside of RAD Studio) in read-only mode, use the Type Library Explorer.

GenTLB.exe

When you save or build your project, the type library compiler (GenTLB.exe) generates the actual type library file (.tlb). Then when you subsequently compile or build using IDE commands, the IDE (not GenTLB.exe) creates the .pas or .cpp file.

Note: If you compile or build outside of the IDE, the possibility exists that your .tlb file might get out of synch with the .pas or .cpp file. To ensure that your .tlb file stays in synch with the .pas or .cpp file, use the IDE for compiling and building your project.

Type Library Editor Window

The Type Library Editor window displays the .ridl file.

The window has three tabs located on the lower edge of the window:

  • Code page displays the .ridl (Restricted Interface Definition Language) code. You can edit the RIDL code on this page.
  • Design page is the main Type Library Editor window. The tabs on the Design page enable you to examine the type library, and the fields on the Design page allow you to change the properties of the type library elements.
  • History page displays the history of the type library (see History Manager).

Tabs of the Design Page: The Design page is the actual Type Library Editor window. The various tabs that appear on the top edge of the window display details about the type library element that is currently selected in the object list pane. The tabs that are present vary according to the item you select in the object list pane. For example, some of the tabs that you will see include the following:

  • The Attributes page lists type information for the object selected in the object list pane. .
  • The Parameters page displays the parameters of the method selected in the object list pane.
  • The Flags page lists the flags associated with the currently selected element.
  • The Uses page lists the type libraries that depend on the selected type library.

All the tabs are described more fully later in this topic.

Toolbar

Use the toolbar buttons to create elements in the type library, to refresh the implementation, to register the type library, and to save the RIDL file as a .tlb file. See Toolbar.

Object List Pane

Each instance of an information type in the current type library appears in the object list, represented by a unique icon. Select an icon to see its data pages displayed in the information pane at the right.

Code Page of the .ridl File

Contains the declarations for the currently selected element in RIDL code (Restricted Interface Definition Language). You can use this page to review all the type information at once or to enter changes more quickly than using the other pages.

For example, you can use the Search > Replace command to change default values of parameters - something that would otherwise be tedious to do.

Design Page of the .ridl File

Is the main window of the Type Library Editor. Displays details about the element currently selected in the object list pane. On the Design page, you can set or clear options, and you can specify or select values for specific properties.

You can use the toolbar at the top of the .ridl file window to create new elements in the type library, such as interfaces, methods, properties, and so forth. See Toolbar.

The various tabs at the top of the Design page (described later in this topic) display different types of information related to the element currently selected in the object list pane.

History Page of the .ridl File

Displays the History Manager.

Attributes Page

Lists the type information associated with the object currently selected in the object list pane. You can use the controls to edit these values. The attributes that appear are specific to the selected element.

Item Description

Name

A descriptive name for the type library. The name cannot include spaces or punctuation.

GUID

The globally unique 128-bit identifier of the type library's interface (a descendant of ITypeLib).

Registered Location

Location of the registered type library in your system.

Version

A particular version of the library in cases where multiple versions of the library exist. The version is either a pair of decimal integers separated by a period, or a single decimal integer. The first of the two integers represents the major version number, and the second represents the minor version number. If a single integer is used, it represents the major version number. Both major and minor version numbers are short unsigned integers in the range between 0 and 65535, inclusive

LCID

The locale identifier that describes the single national language used for all text strings in the type library and its elements.

DispID

The dispatch ID number of the interface. Identifies a particular member of an interface/dispinterface. The DispID is used by clients when invoking members of an automation object.

V-Table Offset

Appears only for properties inside an interface. Indicates the order of the property.

Help String

A short description of the type library. Used with Help Context to provide Help as a Help file. This string is mapped to the Help Context when creating the help file.

Help Context

The Help context ID of for the type library's main help. This ID identifies the Help topic within the Help file.

Help String Context

For help DLLs, the Help context ID of the type library's main help. Used with Help String DLL to provide Help as a separate DLL.

Help File

The name of the help file (.chm or .hlp) associated with the type library, if any.

Help String DLL

The fully-qualified name of the DLL used for help, if any.



Note: The Type Library editor supports two mechanisms for supplying help. The traditional help mechanism, where a standard Windows help file has been created for the library, or a separate DLL that contains the help (for localization purposes). You must supply the help file to which the Help attributes apply.

Flags Page

Lists various attributes that modify the object described on the Attributes page. This page is only available for some elements.

Some type library elements have flags that let you enable or disable certain characteristics or implied capabilities. The flags page lists several check boxes that let you turn these flags on or off.

Implements Page

Only available when a CoClass is selected in the Object List pane. Lists the interfaces that the CoClass implements. Use this page to change the interfaces associated with the object or change their properties.

Item Description

Interface

Name of an interface or dispinterface that the CoClass supports. Note that the name for interfaces and dispinterfaces is assigned on the Attributes page when the interface is selected.

GUID

The globally unique identifier for the interface. This column is informational only: its value cannot be changed.

Source

Indicates whether the interface functions as an event source. If so, the CoClass does not implement the interface. Rather, clients implement the interface and the CoClass calls them using this interface when it fires events.

Default

Indicates that the interface or dispinterface represents the default interface. This is the interface that is returned by default when an instance of the class is created. A CoClass can have two default members at most. One represents the primary interface, and the other represents an optional dispinterface that serves as an event source.

Restricted

Prevents the item from being used by a programmer. An interface cannot have both restricted and default attributes.

VTable

Indicates whether interface methods can be called using a VTable (as opposed to IDispatch calls). This column is informational only: its value cannot be changed.



Parameters Page

Only available when a property or method is selected in the Object List pane. It lets you set the parameters and return value for methods (including property access methods).

Item Description

Name

Represents the parameter name. You can edit the value directly.

Type

Represents the data type of the parameter. Select an available type from the drop-down list that appears when you click in the Type column.

Default Value

Specify a default value for an optional parameter by typing it into the column. All subsequent parameters must be optional. Any preceding optional parameters should also have a default value.When working in Object Pascal, local IDs are specified using a parameter type specifier of TLCID. In IDL, this is specified using a parameter modifier.



Uses Page

Only available when the type library is selected in the Object List pane. Lists other type libraries that contain definitions on which this one depends.

To add a dependency, check the box to the left of the type library name. The definitions in that type library can then be used by this one. If the type library you want to add is not in the list, right click and choose Show All Type Libraries.

To remove a dependency, uncheck the box to the left of a type library name.

To view one of the other type libraries, select that type library, right click and choose View Type Library.

COM+ Page

Use this page to change the transaction attribute of a transactional object you will install with MTS or the COM+ attributes of a CoClass you will install with COM+.

You can also use this page for Automation objects that were not created using the Transactional Object wizard, and it will influence the way the IDE installs them into MTS packages or COM+ applications. However, objects that are not created using the wizard do not automatically include support for IObjectControl. This means that they are not notified about activation and deactivation (and so do not have OnActivate and OnDeactivate events). They also do not have an ObjectContext property. You must therefore obtain the object context by calling the global GetObjectContext function.

Note: Only the Transaction Model attribute is used when installing into an MTS package, all other settings are ignored. If you intend to install the object under MTS, it must be an Automation object in an in-process server (DLL).

Warning: The attributes you specify on the COM+ page are encoded as custom data in the type library. This data is not recognized outside of Delphi. Therefore, it only has an effect if you install the transactional object from the IDE. If you deploy your object in any other way, these settings must be explicitly set using the MTS Explorer or COM+ Component Manager.

Item Description

Call Syncronization

COM+ only: Determines how the object participates in activities. These provide additional synchronization support beyond that supplied by the threading model.

Transaction Model

Specifies the transaction attribute, which indicates how the object participates in transactions, if at all. The possible values differ depending on whether the object is to be deployed under MTS or COM+. Note that if the transaction attribute indicates that transactions are supported, Just In time Activation must be enabled.

Object Pooling

COM+ only: Determines whether object instances can be pooled. When enabling Object Pooling, it is your responsibility to ensure that the object is stateless.

Creation TimeOut

COM+ only: Determines how long, in milliseconds, a pooled object remains in the object pool before it is freed.

Allow Inproc Subscribers

Only applicable when the CoClass represents a COM+ event object. Determines whether in-process applications can register interest as clients of the event object.

Fire In Parallel

Only applicable when the CoClass represents a COM+ event object.Determines whether COM+ fires events in parallel (on multiple threads), or one by one on the same thread.

See Also