COPYOBJECT action


Function
The action will create a copy of an object.
Declaration
 COPYOBJECT srcObject, newNameStr, aliasNewObject
Parameters
srcObjectinReference to object.
newNameStrinValue identifier of Text type.
aliasNewObjectoutIdentifier, where the reference to new-created object will be inserted in.
Description
The source object (template object) may be an object of Graph type. the action will copy this object under a new name, that is given by newNameStr parameter. New name must meet the rules for object name in the D2000. Invalid name will generate the error _ERR_RANGE_ERROR.

After a successful creation of a new object, the reference to this new object is assigned to the parameter aliasNewObject.

Note
Within active picture, the action allows to create a temporary object copy if the parameter newNameStr is empty string. The temporary object copy is terminated after the picture, within the frame of which the action COPYOBJECT is called, is closed or after closing the object copy.
Temporary object copy can be used in case that there is no need to store the copy in the configuration database. The D2000 system automatically deletes these temporary object copies if they are no longer used.
Example
The example assumes the existence of the object D.Graph of GRAPH type.

 
ALIAS _newObject
 
 COPYOBJECT D.Graph, "D.GraphCopy", _newObject
 
; Test of the action success
 
IF _newObject\HBJ = 0 THEN
 
  ; graph copy was not created
 
ELSE
 
  ; graph copy was created
   ; Open it in HI
 
  OPEN _newObject ON WS_PC.HIP
 
ENDIF
 

Related pages:

Napíšte komentár