Wiki Home

Member Data

Namespace: WIN_COM_API
Member Data is a feature added in VFP 9 that allows a developer to specify attributes about members (properties, events, and methods) of classes. Among the attributes you can specify are display case (you can now overcome the limitation of all custom members being displaying in lower case; this works in the Properties window and IntelliSense) and whether a member appears on the Favorites tab of the Properties window.

This feature is implemented by adding a _MemberData property to a class. This property must contain XML that specifies the attributes for the members in the class. Here's an example: (note the HTML below is slightly mangled for ease of display).
< font face="Courier New">
< VFPData>
< memberdata name="myproperty1" type="property" display="MyProperty1"/>
< memberdata name="myproperty2" type="property" display="MyProperty2" favorites="True"/>
< memberdata name="myproperty3" type="property" display="MyProperty3" script="do MyEditor.PRG"/>
< memberdata name="mymethod" type="method" display="MyMethod" helptext="This is my custom method"/>
< memberdata name="caption" type="property" favorites="True"/>
< /VFPData>
< /font>

The first element specifies that the custom property "myproperty1" is displayed as "MyProperty1" in the Properties window and IntelliSense. The second element specifies that the custom property "myproperty2" is displayed as "MyProperty2" and appears in the Favorites tab. The third element specifies that the custom property "myproperty3" is displayed as "MyProperty3" and has a custom editor (similar to a builder) called MyEditor.PRG that can be launched by double-clicking on the property in the Properties window or by clicking on the button with the ellipsis that appears next to the textbox where the value for the property is entered. The fourth element specifies how the custom method "mymethod" is displayed and specifies a custom attribute called "helptext". The last element shows that Member Data applies to native members as well.

Of course, you could type this XML directly into the _MemberData property, but the Member Data Editor that comes with VFP provides a nice user interface for the Member Data for the selected object. You can bring up the Member Data Editor by selecting Member Data Editor from the Form or Class menus.

For more details on Member Data, see

-- Doug Hennig
Category VFP IDE
( Topic last updated: 2004.11.03 12:30:47 PM )