PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Operations performed via ExecuteProcess and via the indirection operators
  • Using ExecuteProcess
  • Using the indirection operators { ... }
  • Example
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
Overview
Several types of WLangage variables are used to enumerate and to dynamically handle the objects of a class. A developer who is familiar with the Object-Oriented Programming (OOP) can create custom methods that adapt to the objects found in a class.
You have the ability to enumerate:
During this enumeration, you will have the ability to retrieve:
  • the element name.
  • the type of the element.
For example:
  • ability to retrieve the name of a method in order to call it by using ExecuteProcess.
  • ability to retrieve the name and type of a variable to find out or assign its value by using the indirection operators { }.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
How to proceed?
The different steps for enumerating and handling an object are as follows:
  1. Retrieving the definition of the object to handle via GetDefinition.
    Example:
    O is cWord    // Instantiation of the CWord class
    Def is Definition // Declaration of Definition variable

    Def = GetDefinition(O)  // Retrieve the definition of the O object in the Def variable

    Trace(Def..Name)  // Display the name of the object
    Trace(Def..DefinitionFamily)
    Trace(Def..Type) // Display the type of the object
  2. Retrieving the list of methods. A "FOR EACH" loop is used to read the ..Procedure property of the Definition variable. This property corresponds to an array containing all the procedures found in the described object.
    Example:
    // Declaration of the variable that will contain the description of a procedure
    Proc is PROCEDURE Description  

    // List of procedures (or methods) of the Def object
    FOR EACH Proc OF Def..Procédure
            Trace (Proc..Name)  // Displays the name of the procedure found
    END

    Other properties can be accessed by using ..PropertyName on the object. See Procedure Description for more details.
  3. Retrieving the list of properties. A FOR EACH loop is used to read ..Property. This property corresponds to an array containing all the properties found in the described object.
    Example:
    // Declaration of a variable that will contain the description of a property
    Prop is Property Description  

    // List of properties of the Def object
    FOR EACH Prop OF Def..Property  
            Trace (Prop..Name)  // Displays the name of the property found
    END

    Other properties can be accessed by using ..PropertyName on the object. See Property Description for more details.
    Versions 18 and later
    You also have the ability to use PropertyExist to find out whether a specific property exists in a class.
    New in version 18
    You also have the ability to use PropertyExist to find out whether a specific property exists in a class.
    You also have the ability to use PropertyExist to find out whether a specific property exists in a class.
  4. Retrieving the list of variables. A FOR EACH loop is used to read ..Variable. This property corresponds to an array containing all the variables found in the described object.
    Example:
    // Declaration of the variable that will contain the description of a variable
    Prop is Variable Description  

    // List of variables of the Def object
    FOR EACH Var OF Def..Variable  
    // Displays the name and type of Variable found
    Trace (Var..Name, Var..Declaration..Type, Var..Definition..Name)
    END

    Other properties can be accessed by using ..PropertyName on the object. See Variable Description for more details.
Operations performed via ExecuteProcess and via the indirection operators

Using ExecuteProcess

ExecuteProcess is used to call the code of an event associated with an object.
For example, the following code provokes the call of the click code of the Validate button:
ExecuteProcess(ValidateButton, trtClick)
To run a class method, all you have to do is use a "Procedure Description" variable with ExecuteProcess.
For example:
c is BalloonTip
p is PROCEDURE Description
Def is Définition

Def = GetDefinition(c)
// Retrieves the first procedure of the BalloonTip object
p = Def..Procédure[1]  

// Runs the procedure represented by p of the c object
ExecuteProcess(c, p)

Using the indirection operators { ... }

The indirection operators { } are used to handle the content of a variable by indirect addressing: the name of the object to address is found in a variable.
The syntax is as follows:
{Variable_containing_Objet_name, VariableType}
where VariableType is a constant of the language starting with indXXX.
Example:
// Fills the "EDT_CITY" control with "Montpellier"
ControlName is string
ControlName = "EDT_CITY"
{ControlName, indControl} = "Montpellier"
To handle a member of a class method, all you have to do is pass in { }:
  • the instance of the class
  • a Variable Description variable or the name of the member.
For example:
c is cWord
var is Variable Description
Def is Definition

Def = GetDefinition(c)
// Retrieves the 2nd variable of the class: version of Word
var = Def..Variable[2]

Trace(var..Name) // Displays the variable name
Trace("Version of Word: ",{c, var})  // Displays the version of Word
Example
The code example below is used to enumerate all the procedures, properties and variables found in a class. In this example, the cWord class is issued from the "WD Controlling Word" example (supplied with WINDEV).
o is cWord
def is Définition
def = GetDefinition(o)

Trace(def..Name)
Trace(def..DefinitionFamily)
Trace(def..Type)

Proc is PROCEDURE Description
Prop is Property Description
Var is Variable Description

Trace("--------------- Procedures --------------------")
FOR EACH Proc OF def..Procedure
Trace(Proc..Global, Proc..Inherited, Proc..Name, Proc..Virtual)
END

Trace("--------------- Properties --------------------")
FOR EACH Prop OF def..Property
Trace(Prop..Declaration, Prop..Definition, Prop..Write, ...
Prop..Global, Prop..Inherited, Prop..Read, Prop..Name, Prop..Virtual)
END

Trace("--------------- Variables --------------------")
FOR EACH Var OF def..Variable
Trace(Var..Name, Var..Definition..Type, Var..Definition..Name)
SWITCH Var..Definition..Type
CASE 1, 4, 8, 19
// Display the value of the variable via indirection
Trace({o,Var})  
CASE 34 // array
Trace("Dimension: ",{o,Var..Name}..Occurrence)
CASE 36 // structure
v is Variable Description
Trace("Structure "+Var..Definition..Name)
Trace("........................................................")
FOR EACH v OF Var..Definition..Variable
Trace(v..Name, v..Definition..Type, v..Definition..Name)
END
Trace("........................................................")
OTHER CASE

END
Trace("======================================================================")
END
Minimum required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment