PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Special case: the dynamic arrays
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
New is used to allocate memory space to contain:
Example
// Syntax 1
CustomerArray is dynamic array
// Create this dynamic array
CustomerArray = new dynamic array of 4 by 7 int
// Syntax 2
MFile is Class
Name is string
Extension is string
Directory is string
END
SourceFile is object MFile dynamic
...
// Instantiate the object
SourceFile = new MFile
// Process on the object
// Syntax 3
// Create a dynamic automation object
MyDynamicObject = new Automation object MyServer
// Syntax 4
ProductRef is structure
        SCode is int
        PdtCode is fixed string on 10
END

Armchair is dynamic ProductRef
Chair is dynamic ProductRef
...
Armchair = new ProductRef
Armchair:SCode = 7
Armchair:PdtCode = "Furniture"
Syntax

Creating a dynamic array Hide the details

<Name of dynamic array> = new dynamic array of <Dimension 1> [by <Dimension 2> ... [by <Dimension 10>]] <Type of array elements>
OR
<Name of dynamic array> = new dynamic array of <Dimension 1> [, <Dimension 2> ... [, <Dimension 10>]] <Type of array elements>
<Name of dynamic array>:
Name of the dynamic array to use. This array was declared beforehand.
<Dimension 1>...<Dimension 10>:
Dimension 1 to 10 of the array (integer value).
<Type of array elements>:
Type of the elements found in the array.
Notes:
  • The a and dynamic keywords are optional: they provide better readability.
  • See Arrays for more details.

Instantiating a dynamic class object Hide the details

<Object name> = new <Class name> ([<Parameters>])
<Object name>:
Name of the class instance.
<Class name>:
Name of the class to instantiate. This name was defined when the class was created in the code editor.
<Parameters>:
Optional parameters of constructor.
See Dynamic instantiation of object for more details.

Creating a dynamic automation object Hide the details

<Name of dynamic automation object> = new automation object <Name of automation server>
<Name of dynamic automation object>:
Name of the dynamic automation object to create. This object was declared beforehand.
<Name of automation server>:
Name of the server of dynamic automation object.
See Dynamic automation object for more details.

Creating a dynamic structure variable Hide the details

<Variable name> = new <Name of dynamic structure>
<Variable name>:
Name of the dynamic structure variable to create.
<Name of dynamic structure>:
Name of a structure that was declared beforehand.
See Dynamic structure for more details.
Remarks

Special case: the dynamic arrays

If the dynamic array is declared and assigned in a single code line, there is no need to use the New keyword to reserve memory space.
For example:
// Declare and create a dynamic array
CustomerArray is dynamic array of 4 by 7 int

// Is equivalent to

CustomerArray is dynamic array
CustomerArray = new dynamic array of 4 by 7 int
Note: In this case, Delete must not be used to explicitly delete the dynamic array. A runtime error will occur if Delete is used.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment