This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
New shared object
|
New shared object {( property ; value {; property2 ; value2 ; ... ; propertyN ; valueN} )} -> Function result | ||||||||
Parameter | Type | Description | ||||||
property | Text |
![]() |
Name of property to create | |||||
value | Text, Date, Boolean, Pointer, Number, Object |
![]() |
Value of property | |||||
Function result | Object |
![]() |
New shared object | |||||
The New shared object command creates a new empty or prefilled shared object and returns its reference. Adding or editing a property to this object must be surrounded by the Use...End use structure, otherwise an error is generated. Reading a property without a Use...End use structure is, however, possible.
Note: For more information on shared objects, please refer to the Shared objects and shared collections page.
If you do not pass any parameters, New shared object creates an empty object and returns its reference. You must assign this reference to a 4D variable declared with the _O_C_OBJECT command.
Note: _O_C_OBJECT declares a variable of the Object type but does not create an object.
Optionally, you can prefill the new object by passing one or several property/value pairs as parameters:
Note: Unlike standard (not shared) objects, shared objects do not support pictures, pointers, and objects or collections that are not shared.
(*)When a shared object or collection is added to a shared object, they share the same locking identifier. For more information on this point, refer to the About the locking identifier (how shared groups work) section.
You want to create a new prefilled shared object:
C_OBJECT($contact)
$contact:=New shared object("name";"Smith";"firstname";"John")
You want to create and modify a shared object. The structure must be called for this object:
C_OBJECT($s_obj)
$s_obj:=New shared object("prop1";"alpha")
Use($s_obj)
$s_obj.prop1:="omega"
End use
New object
New shared collection
Shared objects and shared collections
Product: 4D
Theme: Objects (Language)
Number:
1526
Created: 4D v16 R6
4D Language Reference ( 4D v20 R7)