Synopsis
OMobj_id OMcreate_obj (
OMobj_name newobj_name,
OMtype_id type,
OMobj_id parent,
OMnull_obj
OMproc_id proc );
Description
This is a low-level routine for creating a new object from a base type. Most users should use the routine OMcreate_obj_from_path to create new objects. Only use this routine if there is no template object defined of the type you wish to create.
OMcreate_obj creates an object whose type is type , a primitive type such as group, macro, or int. The new object's name is newobj_name . The object becomes an immediate subobject of parent . The object executes in the process indicated by proc .
The new object's instanced flag is not set, even if the object is an instance. You can set the instanced flag explicitly with a call to OMclose_obj.
To create an object whose type is a class, call OMcopy_obj or OMcreate_obj_from_path instead.
Arguments
newobj_name
The name of the new object.
If you specify OM_NULL_NAME, the Object Manager gives the new object the same name as class .
It is your responsibility to ensure that the new object's name is unique within parent . If an object of the same name already exists in parent , the Object Manager replaces the existing object with the new one.
The routine OMget_uniq_name is useful for determining a unique name for an object.
By contrast, the routine OMcreate_obj_from_path assures that the new object has a unique name.
type
The object's primitive type.
The include file om_type.h defines the type variables you can specify for type , including the following common ones:
OM_type_byte
OM_type_char
OM_type_cmethod
OM_type_double
OM_type_float
OM_type_group
OM_type_ilink
OM_type_imlink
OM_type_int
OM_type_macro
OM_type_method
OM_type_olink
OM_type_omlink
OM_type_prim
OM_type_ptr
OM_type_short
OM_type_string
Alternatively, you can use the routine OMstr_to_type to return the type id corresponding to the type's string name.
parent
The id of the new object's parent. parent can be any object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro.
For parent you can specify OMnull_obj. The new object is created with no parent. You can subsequently assign it a parent with OMadd_subobj.
OMnull_obj
The fourth argument must be OMnull_obj.
proc
The new object's process.
Typically you specify OMlocal_proc_id, a predefined variable set to the id of the calling process.
Alternatively, you can call OMobj_proc to get the process id of a particular object.
Returned value
he id of the new object; OMnull_obj on an error.
See also