IMcObjectsAdd Method
|
|
Creates a new McObject of a given type, with an optional name,
parent and initial value.
Namespace:
MediaCy.IQL.ObjectManager
Assembly:
MediaCy.IQL.ObjectManager (in MediaCy.IQL.ObjectManager.dll) Version: 10.0.6912.0
SyntaxFunction Add (
varTypeNameOrEnum As Object,
Optional bstrName As String = "",
Optional bstrNamespace As String = "",
<OptionalAttribute> varInitialValue As Object,
<OptionalAttribute> varParentIMcObject As Object,
Optional lTagNumber As Integer = 0,
<OptionalAttribute> varCategoryNameOrID As Object
) As McObject
Parameters
- varTypeNameOrEnum
- Type: SystemObject
[in] Type of object to create. Can either be
a BSTR typename or a long or short mcobjTypeEnum object type - bstrName (Optional)
- Type: SystemString
[in, optional] Name of object, or NULL or empty for an
unnamed object. This name must be globally unique within its Namespace
unless an varParentIMcObject argument is supplied, in which case the name
must be unique among the child objects of that object. - bstrNamespace (Optional)
- Type: SystemString
[in, optional] Namespace for the object name, or NULL
or empty to use the default Namespace (see the Namespace property, and the
Item method). Namespaces you use should generally start with "McOM". - varInitialValue (Optional)
- Type: SystemObject
[in, optional] An intial value to be assigned to
the object. If this is not given, the object is initially empty, unless the
varTypeNameOrEnum was that of a type registered with the
RegisterInterfaceClassFactory method. In this later case, the interface is
created by calling the class factory. - varParentIMcObject (Optional)
- Type: SystemObject
[in, defaultvalue(NULL)] If NULL, then the
object is global. Otherwise this is its parent object. - lTagNumber (Optional)
- Type: SystemInt32
[in, defaultvalue(0)] An initial TagNumber property to
assign to the object. If this number is positive, it must unique for all
objects with the same (or no) varParentIMcObject; objects with these tags
can be found quickly with the LookupByTagNumber method. - varCategoryNameOrID (Optional)
- Type: SystemObject
[in, optional] Category name or ID (as
returned from RegisterCategory). If not empty then this is an initial
category in which to make the object a member. Assign to the
McObject.Category property to make the object a member of additional
categories.
Return Value
Type:
McObjectThe new McObject instance.
See McObject.AttachNotifySink for an explaination of Alias-related notify issues.
And see SetEnumFilters and GetCategory_NewEnum for Alias-related enumeration
issues.
RemarksThe object may be created as a "child" object local to some "parent"
McObject. If the object is a child then the name may be the same as other
objects within its Namespace with different parents. For object types registered by
RegisterInterfaceClassFactory, the interface is created as well.
The mcobjTypeFlagAlias flag can be OR'ed with another mcobjTypeEnum to
cause the object being created to be an "Alias" McObject. Once an Alias-type
object is created, you need to assign a Shadow (see below) to its ShadowMcObject
property. When you create an Alias object, you should either specify its
varTypeNameOrEnum as (mcobjTypeUNKNOWN | mcobjTypeFlagAlias) or as some base type
with the mcobjTypeFlagAlias OR'ed in. The latter is preferable, since in this
case you get type checking when the ShadowMcObject property is assigned to. For
example, an Alias created of type (mcobjTypeXOBJECT | mcobjTypeFlagAlias) then
you could only assign as a ShadowMcObject objects of Type mcobjTypeXOBJECT or
ones where RegisterType had been derived from mcobjTypeXOBJECT.
An alias object is one that refers to the data held by another "Shadow" McObject
instead of holding any data of its own. An Alias McObject is associated with a
particular Shadow by assigning to its ShadowMcObject property. Alias objects
expose some of the properties of their current Shadow object as their own. For
example, the Alias' Value property reflects the Value of the Shadow McObject, and
assignments to the Alias' Value property change the Shadow McObject's Value. The
following McObject properties are independently maintained for the Alias
ParentMcObject
Name
Namespace
Category
TagNumber
CreatorCollection
Notification sinks
The following are reflected from the shadow
Type (except that the mcobjTypeFlagAlias will be set in the Type Number)
UserFlags
All data related properties, includine Value, Interface, VectorLength, etc.
See Also