PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Declaring a Control variable
  • Assigning a Control variable
  • Using a Control variable in a procedure
  • Optimizing the processes with indirection
  • Properties associated with a Control variable
  • Functions that handle a Control variable
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
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.
AndroidAndroid Widget Java ControlCreate is not available.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Versions 24 and later
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
Java This type of variable is now available for Java applications.
New in version 24
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
Java This type of variable is now available for Java applications.
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for Android applications.
Java This type of variable is now available for Java applications.
Example
WINDEV
// Création dynamique d'un champ dans une fenêtre
c is Control
c <- ControlCreate("BOUTON_1", typButton, 30, 40, 140, 20) // Attention, pas '='
 
c.Libellé = "Cliquez moi"
 
c.Traitement[trtClick] = maProcédure
Remarks

Declaring a Control variable

The following syntax is used to declare a Control variable:
<Nom de la variable> est un Champ

Assigning a Control variable

A Control variable can be used to handle:
  • a control found in a window or in a report.
  • WINDEV a control created by ControlCreate.
The assignment of a Control variable must be performed by the '<-' operator.
Examples:
// Affectation avec un champ existant
c is Control
c <- SAI_Saisie1
// Affectation en utilisant l'indirection
// La variable référence le champ SAI_SAISIE2
c <- {"SAI_SAISIE2"}
WINDEV
// Affectation avec un champ créé avec la fonction ChampCrée
c is Control
c <- ControlCreate("BOUTON_1", typButton, 30, 40, 140, 20)
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:
// Affectation avec un champ existant
c is Control
c <- SAI_Saisie1
 
 
// Modification de la valeur
c = SAI_Saisie3 // Code équivalent: SAI_Saisie1..Valeur = SAI_Saisie3..Valeur
 
c = "Texte" // Code équivalent: SAI_Saisie1..Valeur = "Texte"
Remark: To find out if the Variable of type Field has been affected, use the Property Type 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:
    PROCÉDURE MaProcédure(C is Control)
    C = "Il est " + TimeSys()
  • the call to the procedure:
    MaProcédure(SAI_Saisie1)

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 Champ <-{s, indControl}
C.Largeur = 10
C.Hauteur = 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 find out the properties of a control, see the help page of control: 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.
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment