Description

Returns a “temporary” McObject of a given type, shaped as an array.

Return Type

A McObject object.  

A new McObject instance is returned; this instance will not be part of the McObjects collection, so it will be destroyed as soon as it is Released.

Syntax

object.McArrayTemp (TypeNameOrEnum, [DimensionSizes])

The McArrayTemp Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McOMGlobal.
TypeNameOrEnumRequired. A Variant value.

Type of object to create. Can either be a BSTR typename or a long or short mcobjTypeEnum object type. The allowed mcobjTypeEnum and their corresponding names are

mcobjTypeINTEGER    // INTEGER      32-bit integer (VB Long type)
mcobjTypeLONG       // LONG         32-bit long
mcobjTypeBYTE       // BYTE         8-bit unsigned
mcobjTypeCHAR       // CHAR         8-bit unsigned character
mcobjTypeREAL       // REAL         64-bit double (VB Double type)
mcobjTypeBOOLEAN    // BOOLEAN      32-bit integer boolean or selector
mcobjTypeFLOAT      // FLOAT        32-bit float (VB Single type)
mcobjTypeSHORT      // SHORT        16-bit signed

DimensionSizesOptional. A Variant value.

If given, this must be a scalar integral value or an array of integral values, one for each dimension using C/C++ dimension ordering (1st array element is the slowest moving dimension, see Remarks for more discussion). If no array shape is supplied, the new object will be a zero-length, one dimensional array of the given type.

Remarks

A new, unnamed “temporary” McObject of the specified data type is created and then optionally shaped as an N-dimensional array. The values (if any) are initialized to zero.

If no array shape is supplied, the new object will be a zero-length, one dimensional array of the given type. This will often be useful if you are concatenating values to build up some array of values.

The returned McObject will have the mcobjUserFlagAlwaysVector set in its UserFlags property, so that even length-1 arrays are treated as vectors. You may clear this flag if you wish a length-1 array to be treated as a scalar.

The newly created McObject will be unnamed and have no ParentMcObject, and it will not be part of the McObjects collection, so it cannot be looked up via the Item property nor will it appear in any enumeration. If any of this is a problem, call the McObjects.Add method directly to create an object that is part of the collection. Use the McObject.RemoveFromCollection method to remove the new instance from the collection, effectively making it a “temporary” object. You may then assign to the McObject.Shape property to set the shape of the object.

To set a new shape for an object supply the varDimensionSizes argument as an array of values, one size for each dimension (for one-dimensional shapes, either a scalar value or an length-1 array can be passed in). The last element in the assigned array is the fastest moving dimension (this corresponds to dimension number 1 that would be passed to the VB UBound or LBound functions). That is, the dimension ordering of this array corresponds to C/C++ (or almost all other languages other than VB or FORTRAN) dimension ordering, where the first (left-most) dimension size is the slowest moving, “row” dimension.

If the assigned dimension size value is positive, then the corresponding dimension is made “fixed”. Fixed dimensions are not allowed to change size when assigned via the SelectedValues property with all missing selector arguments (or when the OpBareAssign method is called).

If the value is zero or negative, then the corresponding dimension is made “variable”, with all elements having an initial size equal to the absolute value of the given size. Variable dimensions can have varing size elements, and the slowest moving dimension can change size.