|
- When should I use the indirection?
- 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
// Simple indirection {"NAME"} = CustName // Is equivalent to NAME=CustName {"NAME"} = {"CU.CUSTNAME"} // Is equivalent to NAME=CU.CUSTNAME {"CUSTWIN.NAME"} = CustName // Is equivalent to CUSTWIN.NAME=CustName {"CUSTWIN"+".NAME"} = CustName // Is equivalent to CUSTWIN.NAME=CustName
// Typed indirection {"Name",indControl} = CustName
// Indirection with a file name in a variable nFileName is string = "Customer" {nFileName + ".Name"} = "Smith" HAdd({nFileName})
// Indirection in a procedure ControlName is string ControlName = "EDT_EDIT1" // EDT_EDIT1 is the name of the control // Call to a procedure used to make a control invisible Make_Invisible(ControlName)
PROCEDURE Make_Invisible(ControlN) {ControlN}..State = Invisible
// Indirection with variable AliasName is string AliasName = PreviousWin() // NAME is the name of the control // CustName is the value to assign {AliasName+".NAME"} = CustName Abbrev is string ItemName is string {Abbrev+"."+ItemName} = CustName {Abbrev+"."+ItemName} = {ControlName}
// Declare a class with two members MyClass is Class Member1 is string Member2 is string // Display the value of a member GLOBAL PROCEDURE DisplayMember(Number) // Retrieve the value of the selected global member Value is string = {"::Member"+Number} Info(Value)
Versions 16 and later
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 Word version
New in version 16
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 Word version
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 Word version
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 dot: search among the controls, then the HFSQL items.
- 1 dot: search among the HFSQL items, the controls, then the query parameters.
- greater than 1 dot: search among the controls.
- 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"}
- not global, use the following syntax: {" : MemberName"}
A WLanguage error occurs if this expression corresponds to an empty string (""). Versions 16 and later <Class>: Character string Class instance <Member>: Character string or Variable Description variable Corresponds to: New in version 16 <Class>: Character string Class instance <Member>: Character string or Variable Description variable Corresponds to: <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 | Element sought among the 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 I use the indirection? The indirection can be used for example: - To access the value of an element (control, variable, item, ...):
{s_ControlName} = 10 ControlValue = {s_ControlName}
- To use a property:
{s_ControlName}..Height = 10
- To handle a column of a memory table:
{s_ColumnName, indControl}[Row_Number] = 10
- To handle a table column:
{s_TableName + "." +s_ColumnName, indControl}[Row_Number] = 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…
|
|
|
| |
| exemplo indirection, quantos controles |
|
| == nome_controle is string="" contador is int=1 LOOP nome_controle = EnumControl(WIN_idirection, contador) IF nome_controle="" THEN contador-- BREAK ELSE Trace(nome_controle) contador++ END END Trace("numero de controles:"+contador) == https://windevdesenvolvimento.blogspot.com/2021/01/dicas-3242-windev-perguntas-e-respostas.html
https://youtu.be/K9ZCHWxJer4
|
|
|
|
| |
| |
| |
|
| | https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/3239-procedure-com-indirection-para-selecionar-registro-uma-grid-3240/read.awp |
|
|
|
| |
| |
| |
|
| | https://youtu.be/ehyDAM2lLOA
https://windevdesenvolvimento.blogspot.com/2019/06/dicas-2143-windev-webdev-mobile.html
// btn_calcula nome_campo is string="" FOR CONTADOR=1 TO 5 nome_campo="EDT_VALOR_"+CONTADOR EDT_VALOR_RESULTADO+={nome_campo} END
|
|
|
|
| |
| |
| |
|
| | PROCEDURE UI_CargaComboClientes(InternalWindow_COMBO_QRY_Clientes_Ativas)
NomeCliente is string = {InternalWindow_COMBO_QRY_Clientes_Ativas}..DisplayedValue IF NomeCliente <> "" ListDeleteAll({InternalWindow_COMBO_QRY_Clientes_Ativas,indControl}) //filtro prof e empresas SqlCodigo is string = [ SELECT T001_CLIENTES.T001_ID_USUARIO AS T001_ID_USUARIO, T001_CLIENTES.T001_NOME AS T001_NOME FROM T001_CLIENTES WHERE T001_CLIENTES.AUDT_Excluido = 'N' AND T001_CLIENTES.T001_NOME LIKE '%{ParamT001_NOME}%' ] X, Codigo is int Matricula,Cliente is string SqlCodigo = Replace(SqlCodigo,"{ParamT001_NOME}",NomeCliente,IgnoreCase) dsQueryCombo is Data Source ... |
|
|
|
| |
| |
| |
|
| Exemplo Indirection Operator |
|
| Exemplo Indirection Operator
//gravar numeracao EDT_Numeracao="" n_contador is int=0 s_nome_campo is string="" EDT_Quantos_numeros=0 //Estou Fazendo um Loop para ir ate o edt 30 //Exemplo: //edt_num1 //edt_num2 //edt_num3 //... //edt_num30
LOOP n_contador++ s_nome_campo="EDT_num_"+n_contador // edt_num1 edt_num2 ... // aqui é como se ficasse => s_nome_campo=EDT_NUM1 / snome_campo=EDT_NUM2... E ASSIM POR DIANTE EDT_Numeracao+={s_nome_campo}+"|" // edt_numeracao=edT_num_1 .. // AQUI vai pegar o resultado de cada edt_num que coloquei no s_nome_campo //exemplo: // edt_numeracao=28 // Resultado do edt_num1 IF {s_nome_campo}<>"" THEN EDT_Quantos_numeros++ END IF n_contador>=30 THEN BREAK END END //no final o edt_numeracao vai ficar assim: //28|29|30|31
// Agora para Recuperar Informacao //recuperar numeros //28|29|30|31 //vou recuperar cada quantidade que esta em | n_contador=0 s_nome_campo="" //na FOR EACH STRING s_numero OF EDT_Numeracao SEPAREE BY "|" n_contador++ s_nome_campo="EDT_num_"+n_contador {s_nome_campo}=s_numero IF n_contador>=30 THEN BREAK END
//Blog com Video e Exemplo http://windevdesenvolvimento.blogspot.com.br/2016/08/curso-windev-string-016-numeracao-campo.html https://www.youtube.com/watch?v=jdFjoo0Tc78
|
|
|
|
| |
| |
| |
| |
| |
| |
| | |
| |