CreateObject()
CreateObject() function creates an object of a given type and populates it with specified properties.
Syntax
CreateObject(); CreateObject(objectType); CreateObject(objectType, PropName1, PropValue1); CreateObject(objectType, PropName1, PropValue1, ..., PropNameN, PropValueN);
Function arguments
- objectType – (String) [optional] a type of the object that will determine available properties. If null or empty then any property may be provided;
- propName – (String) [optional] a name of the property to set in the object;
- propValue – (UNKNOWN) [optional] a value for the propName property.
When you populate the object with some properties you have also to add some values for them. There may be as many pairs of property name/value as you want or it is required by the given type of object.
Return value
This function returns Object.
Examples
Example 1
This will create an object without specified type and without properties.
someObject = CreateObject();
Example 2
This will create an object without specified type and with two properties.
someObject = CreateObject(null, "Text", "Confirm", "Id", "confirm");
Example 3
This will create an object with type „Confirm.Button” (a button for Confirm() function) and with three properties defined for this type.
button = CreateObject("Confirm.Button", "Text", "Confirm", "Id", "confirm", "Type", "primary");
See also ’Example 2′ in the description of Confirm() function.