Static Property Enumeration ODL allows for the creation of C/C++ style enumeration declarations that conform to the same rules as C/C++. Like C/C++, the new enumeration can be used as data type within the ODL file. While this style of enumeration is by far the easiest, it is also the most restrictive because the enumeration is static to the type library. The Alignment property is a good candidate for an enumeration because internally that is how it is validated and used. Listing 7.8 contains the code that was added to your ODL file to support the Alignment enumeration.
Remember to generate a new UUID for the enumeration with the GUIDGEN.EXE application included with VC++.
The helpstring is what the user will see within the property browser of your development environment. If you leave off the helpstring, the actual numeric value will appear instead.
The last thing you did was to change the data type of the Alignment property from long to EALIGNMENT. This is required if the property is to display the enumerated values within the property browser.
NOTE: ODL is very flexible in that it allows much the same style of data type declaration and use as that of C or C++. Any data type that can be declared in ODL can also be referenced and used within the same and other ODL files, including interface declarations. In addition, other type libraries can be imported into an ODL file to provide access to other user-defined data types. In the case of the sample control, two types of libraries, STDOLE_TLB and STDTYPE_TLB, are included for the standard OLE interface and data type declarations.
The ODL documentation can be a little difficult to decipher, but we recommend that you at least review the documentation. It is well worth the effort just to see what you can and cannot do with your type library and how it will affect the container of your control or component.
It is absolutely critical that the developer of containers adhere to the standards established in the ODL documentation. You will find that some of the aspects of type library creation and use are based on cooperation and trust and that component developers depend on that.