ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / Declaring variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Dynamic structure (Variable type)
In french: Structure dynamique (Type de variable)
A structure can be allocated dynamically: we talk of dynamic instantiation of the structure.
The dynamic instantiation of structure is used to create a structure at a given time and to free this structure when it is no longer used.
To instantiate a structure, you must:
  1. Declare a dynamic structure.
  2. Instantiate a structure.
Remark: The structure is automatically freed when it is not used anymore. However, you can force the destruction of the structure.
Example
MyExampleFile is Structure
Name is string
Extension is string
Directory is string
END
SourceFile is dynamic MyExampleFile
// ...
SourceFile = new MyExampleFile
// Process on the object ...
// ...
// Free the object
delete SourceFile
// Declaration of the structure in the declaration code of a class
MyClass is Class
sMB is string
END

MyExampleFile is Structure 
Name is string
Extension is string
Directory is string
END

//---------------------------------------------------------------------
// Declaration of a dynamic array with this structure:
ArraySourceFile is array * dynamic MyClass.MyExampleFile
Syntax

Declare a dynamic structure Hide the details

<Variable name> is dynamic <Structure name>
<Variable name>:
Name identifying the variable of the structure.
<Structure name>:
Name identifying the structure. This name was defined when creating the structure

Instantiating a dynamic structure Hide the details

<Variable name> = New <Structure name>
<Variable name>:
Name identifying the variable of the structure.
<Structure name>:
Name of a structure that was declared beforehand.

Freeing a dynamic structure Hide the details

Delete <Structure name>
<Structure name>:
Name of the structure variable to use.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/06/2024

Send a report | Local help