The information in this article applies to:
SUMMARYThe Atlenum sample shows how to implement enumerated properties in ATL. MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. Enumerated properties have a predefined set of possible values that you can assign to them. For example, when you define an enumerated property for the days of the week, the only possible values are Monday through Sunday. You can control this by setting up an enumerated property in the .idl file:
Visual Basic 5.0 has a feature called Code Completion. As you enter code,
the editor displays a list of context-sensitive items that you can use in
your code. In the case of an enumerated property, typing an "=" after the
property causes Visual Basic to display a list of possible values. For
example, a list of possible values to complete the following statement
appears when you type:
Enumerated properties also allow you to browse the possible values for a
property in a property browser. Look at the BorderStyle property for any
control in the Visual Basic property browser. Possible values are displayed
in a list box. By default, Visual Basic creates a list in the form of "1 [ASCII 150]
Monday," "2 [ASCII 150] Tuesday," and so on. If you want to the change the display
string, you need to override some methods in the IPerPropertyBrowsing
interface. The Atlenum sample shows how to override the GetDisplayString(),
GetPredefinedStrings(), and GetPredefinedValue() methods. The sample also
implements a property page for modifying the enumerated property.
For additional information on how to implement enumerated properties in the Microsoft Foundation Classes (MFC), please see the following article in the Microsoft Knowledge Base: Q141488 SAMPLE: Using Enumerated Properties in an OLE ControlIf you are converting MFC projects to ATL, you can leave out the tag after the enum keyword in an .odl file, as in the following example:
...
In an .idl file, you need to have a tag after the enum keyword to ensure that you have the right type information:
Additional query words:
Keywords : kbcode kbfile kbsample kbActiveX kbATL210 kbCOMt kbCtrl kbServer kbVC500 kbVC600 kbATL300 kbCodeSam kbGrpMFCATL kbCollectionClass |
Last Reviewed: December 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |