PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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.
Note: See Declaring a variable for more details.
Example
WINDEV
// Dynamically create a control in a window
c is Control
c <- ControlCreate("BUTTON_1", typBouton, 30, 40, 140, 20) // Caution, not '='

c..Caption = "Click me"

c..Process[trtClick] = myProcedure
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.
  • WINDEV a control created by ControlCreate.
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"}
WINDEV
// Assignment with a control created by ControlCreate
c is Control
c <- ControlCreate("BUTTON_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:
// 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"
Note: To find out whether the Control variable was assigned, use ..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 MyProcedure(C is Control)
    C = "It is " + TimeSys()
  • the call to the procedure:
    MyProcedure(EDT_Edit1)

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 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. See Window controls for more details.

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 required version
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment