|
|
|
|
|
|
|
|
|
|
- When should indirection be used?
- Identifying the current object
- Indirection on a structure
- Using the indirection on the paths in an XML document
- Limitations
- Indirections in Java
Indirection operators In french: Opérateurs d'indirection
Operators { and operators } operators are used to access a field, variable, class member or data file item by dynamically constructing the name of the field, variable, class member or item. The { and } operators present several benefits: - Passing as parameter the name of a control, variable, class member or item.
- Building the name of a control, variable, class member or item programmatically.
{"NOM"} = NomCli
{"NOM"} = {"CL.NOMCLI"}
{"FENCLI.NOM"} = NomCli
{"FENCLI"+".NOM"} = NomCli
{"Nom",indControl} = NomCli
nNomFic is string = "Client"
{nNomFic + ".Nom"} = "Durand"
HAdd({nNomFic})
NomChamp is string
NomChamp = "SAI_SAISIE1"
Rend_Invisible(NomChamp)
PROCEDURE Rend_Invisible(NChamp)
{NChamp}..State = Invisible
NomAlias is string
NomAlias = PreviousWin()
{NomAlias+".NOM"} = NomCli
Abrev is string
NomRub is string
{Abrev+"."+NomRub} = NomCli
{Abrev+"."+NomRub} = {NomChamp}
Maclasse is Class
Membre1 is string
Membre2 is string
PROCEDURE GLOBAL AfficheMembre(Numéro)
Valeur is string = {"::Membre"+Numéro}
Info(Valeur)
c is cWord
var is Variable Description
Def is Definition
Def = GetDefinition(c)
var = Def.Variable[2]
Trace(var.Name)
Trace("Version de Word: ",{c, var})
Syntax <Expression>: Character string Expression used to identify the control, the variable or the item to use. The element is sought:- among the variables,
- according to the number of dots found in the name:
- 0 point: search among fields, then HFSQL items.
- 1 point: search through HFSQL fields, then query parameters.
- greater than 1 point: search among fields.
- among the special elements kept for compatibility (_Tabx for example, ...).
A WLanguage error occurs if this expression corresponds to an empty string (""). <Expression>: Character string Expression used to identify the class member.If the member is: - global, use the following syntax: {" :: MemberName"}
- is not global, use the following syntax: {" : MemberName"}
A WLanguage error occurs if this expression corresponds to an empty string (""). <Class>: Character string Class instance <Member>: Character string or Variable Description variable Corresponds to:
Indirection by specifying the element type (optimizes the execution speed) Hide the details
{ <Expression>, <Type> }
<Expression>: Character string Expression used to identify the control, the variable or the item to use. A WLanguage error occurs if this expression corresponds to an empty string (""). <Type>: Constant Constant used to specify the type of sought element: | | | indControl | Element sought among the controls and the groups. | | indConnection | Element sought among the connections. | | indReport | Element sought among the reports. | | indWindow | Element sought among the windows. | | indFile | Item searched for in data files. | | indGPW | Element sought among the elements of user groupware (used to retrieve the initial status of controls). | | indLink | Element sought among the links. | | indQueryParameter | Element sought among the parameters of queries. | | indItem | Element sought among the items. | | indVariable | Element sought among the variables. | | indPage | Element sought among the pages. |
Remarks When should indirection be used? The indirection can be used for example: - To access the value of an element (control, variable, item, ...):
{s_NomChamp} = 10
ValeurChamp = {s_NomChamp}
- To use a property:
{s_NomChamp}..Height = 10
- To programmatically handle a column of a Table control:
{s_NomColonne, indControl}[Numéro_Ligne] = 10
- To handle a table column:
{s_NomTable + "." +s_NomColonne, indControl}[Numéro_Ligne] = 10
Related Examples:
|
Unit examples (WINDEV): The indirections
[ + ] Handling indirections via the { and } operators. The { and } operators are used to access a control or a file item by dynamically building the control name or the item name. This program, powered by WINDEV, implements the indirection mechanism on the window controls to manage the "Undo-Redo" and "Cut-Copy-Paste" features in a generic way.
|
|
Unit examples (WEBDEV): The indirections
[ + ] This example explains how to use the indirections on a variable. You will notice that the indirections are available for the controls, the items, the links, etc. The principle is identical to the one presented in this example.
|
|
Unit examples (WINDEV Mobile): The indirections
[ + ] Using the indirection { and } operators. The { and } operators are used to access a control or a file item by dynamically building the control name or the item name. This example implements the indirection mechanism on the window controls to manage the "Undo-Redo" and "Cut-Copy-Paste" features in a generic way.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|