The
Control type is used to define the characteristics of a control. This control can be dynamically created by
ControlCreate or it can be a control found in a window or in a report.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
Remarks
Declaring a Control variable
The following syntax is used to declare a Control variable:
<Variable Name> is Control
Assigning a Control variable
A Control variable can be used to handle:
- a control found in a window or in a report.
The assignment of a Control variable must be performed by the '<-' operator.
Examples:
// Assignment with an existing control
c is Control
c <- EDT_Edit1
// Assignment by using the indirection
// The variable references the EDT_EDIT2 control
c <- {"EDT_EDIT2"}
Caution: The '=' operator must not be used to assign a Control variable. This operator is used to transfer the value of a control into another control of the same type. For example:
// Assignment with an existing control
c is Control
c <- EDT_Edit1
// Modify the value
c = EDT_Edit3 // Equivalent code: EDT_Edit1.Value = EDT_Edit3.Value
c = "Text" // Equivalent code: EDT_Edit1.Value = "Text"
Remark: To know if a value has been assigned to the Control variable, use the
Type property on the variable.
Using a Control variable in a procedure
The Control type can be a parameter of a procedure. You can write for example:
- the code of the procedure:
PROCEDURE MyProcedure(C is Control)
C = "It is " + TimeSys()
- the call to the procedure:
Optimizing the processes with indirection
The Control type can be used to optimize the processes that use the indirections. You can write for example:
C is Control <-{s, indControl}
C.Width = 10
C.Height = 20
rather than the following code:
{s, indControl}..Width = 10
{s, indControl}..Height = 20
Properties associated with a Control variable
The Control type is used to handle all types of controls found in a window or in a report. The available properties depend on the type of control used.
Therefore, if a Control variable is used to handle an edit control, all the WLanguage properties available for the edit control will be usable on the Control variable.
To get the properties of a control, see the control help page: the "See Also" link is used to access all the control properties. For more details, see
Window controls.
Functions that handle a Control variable
All the WLanguage functions that handle the controls can be used on a Control variable. However, only the WLanguage functions corresponding to the type of control used will be available.
Therefore, the TableXXX functions can be used on a Control variable that handles a Table control.