Share via


AMEMBERS( ) Function

Places the names of properties, procedures, and member objects for an object into a variable array.

AMEMBERS(ArrayName, oObjectName | cClassName [, nArrayContentsID] [, cFlags])

Return Values

Numeric

Parameters

  • ArrayName
    Specifies the array into which the names of the member properties for oObjectName are placed. If you specify the name of an array that doesn't exist, the array is automatically created. If the array isn't large enough to contain all the names, Visual FoxPro automatically increases the size of the array.

  • oObjectName
    Specifies the object whose member properties are placed in the variable array specified with ArrayName. oObjectName can be any expression that evaluates to an object, such as an object reference, an object variable, or an object array element.

  • cClassName
    Specifies the Visual FoxPro class whose member properties are placed in the variable array specified with ArrayName.

  • nArrayContentsID 0 | 1 | 2 | 3
    0 specifies that the array contains a single column of property names. Omitting the nArrayContentsID parameter is the same as passing a 0.

    1 specifies that the array contains the names of the properties of the object or class, as well as the methods and member objects. The resulting array is two-dimensional with the second column specifying what type of member is listed in the first column. The possible values for the second column are Property, Event, Method, or Object.

    2 specifies that the array contains the names of objects that are members of a native Visual FoxPro object specified with oObjectName. The resulting array is one-dimensional.

    This option provides a method to determine the names of child objects in a container such as all Form objects in a form set or controls in a form.

    3 specifies that the array contains information about one or more objects. You can pass an object reference to either a native Visual FoxPro object or to a COM object.

    Note   A value of 3 for this parameter is not supported in .app or .exe applications.

    The array returned when you specify this parameter consists of four columns as described in the following table:

    Column Description
    1 Name of the event or method
    2 Property type (for example, PROPERTYPUT, PROPERTYGET, PROPERTYPUTREF, METHOD)
    3 Function signature (parameters and their types, and the function return type). This information is similar to the Quick Info text provided in IntelliSense expansion of a method.
    4 Help string

    If you omit nArrayContentsID, AMEMBERS( ) returns a one column array of properties.

  • cFlags
    Specify the filtering applied to the array returned by the AMEMBERS( ) function. cFlags will not function when AMEMBERS( ) is passed a COM object (the value of ArrayContentsID is 3). Some flags are mutually exclusive so that if you use more than one cFlag, use them in the following groupings:

    [P | H | G] [N | U] [C] [I | B] [R]
    

    The following tables describe the valid values for cFlags.

    Value Filter Flags
    P Protected properties, methods, or events
    H Hidden properties, methods, or events
    G Public properties, methods, or events
    N Native (Intrinsic) properties, methods, or events
    U User-Defined (Extrinsic) properties, methods, or events
    C Changed properties (but not changed array properties)
    I Inherited properties, methods, or events
    B Base properties, methods, or events (using the AddProperty method)
    R Read-Only Properties

The default configuration for the filtering specified by cFlags is logical OR between flags. You can change this by using the special "+" cFlags.

Value Special Flags
# Adds a new column to the output array with the corresponding cFlags value.
+ Performs logical AND between filter flags.

Remarks

AMEMBERS( ) returns the number of objects, properties, and procedures for the object, or 0 if the array cannot be created. If you omit the optional 1, 2, or 3 flag parameters, a one-dimensional array is created containing the properties of oObjectName.

You can pass COM object references to the AMEMBERS( ) function, but when you do so, you must also pass a value of 3 in the third (flag) parameter, as in the following example.

oExcel = CREATEOBJECT("excel.application")
= AMEMBERS(gaPropArray, oExcel, 3)

Example

The following example uses CREATEOBJECT( ) to create a Form object named goForm1. AMEMBERS( ) is used to create an array named gaPropArray containing the properties available for the form; the properties are then displayed.

CLEAR
goForm1 = CREATEOBJECT("Form")  && Creates a Form
= AMEMBERS(gaPropArray, goForm1, 1)  && Array containing Form properties
DISPLAY MEMORY LIKE gaPropArray  && Display the Form properties

See Also

ADD CLASS | AINSTANCE( ) | CREATE CLASS | CREATE CLASSLIB | CREATEOBJECT( ) | DEFINE CLASS