ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Report controls
  • Overview
  • Initializing or modifying the value of a control
  • General case
  • Special case: Check Box control
  • Special case: Image control
  • Retrieving the value of a control
  • To retrieve the content of a control:
  • Special case: Static control
  • Special case: Preset control
  • Special case: Check Box control
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Handling a control through programming in a report
Overview
All report controls can be handled through programming. To do so, use the control variable in the code. The variable of the control corresponds to the name of the control. You can:
  • assign a value to a report control (or modify its value)
  • retrieve the value of a report control (rarer event as the value cannot be modified by the user)
Remark: For more details on how to handle a report control in a WLanguage process, see Handle an element in a WLanguage process.
Initializing or modifying the value of a control

General case

To initialize a value, all you have to do is allocate the control variable.
For example, for a calculated control:
// Calculate the price IOT of the current product
CALC_MyCalculatedControl = Product.Price * 1.196
Remark on calculated controls: If the control is automatically filled by the report (calculation from a control or item found in the report), no value should be assigned through programming to the "Calculated" control.

Special case: Check Box control

To initialize a check box, all you have to do is assign the variable of the "Check Box" control. By default, no option is checked when a check box is displayed.
To check an option in a check box, use the following syntax:
<Name of Check Box> = 1
<Name of Check Box> = True
To uncheck an option in a check box, use the following syntax:
<Name of Check Box> = 0
<Name of Check Box> = False
For example:
// Assign the value of a check box
CBOX_MyCheckBox = True

Special case: Image control

To display an image file in an "Image" control, a simple assignment is sufficient.
For example:
  • direct assignment:
    IMG_MyImage = "C:\Temp\MyImage.BMP"
  • assignment by variable:
    ImagePath = fCurrentDir() + "\MyImage.BMP"
    IMG_MyImage = ImagePath
Retrieving the value of a control

To retrieve the content of a control:

  • perform a simple assignment. For example:
    CurrentContentCalculatedControl = CALC_MyCalculatedControl
  • handle the control directly. For example:
    IF CALC_MyCalculatedControl>10 THEN...
  • use the Value property.

Special case: Static control

To retrieve the content of a "Static" control:
  • perform a simple assignment. For example:
  • handle the "Static" control directly. For example:
  • use the Value or Caption properties.

Special case: Preset control

The total number of pages found in a report cannot be retrieved. This number is known when printing the last page of the report.

Special case: Check Box control

To find out the value of a "Check Box" control, use the following syntax:
<Control_Value> = <Name of Check Box>
In this case, <Control_Value> is a boolean that is set to:
  • True (or 1) if the box is checked
  • False (or 0) if the box is not checked.
You can for example:
  • run a test on the value of a "Check Box" control. For example:
    IF CBOX_MyCheckBox = True THEN
    // MyControl becomes visible
    MyControl.Visible = True
    END
  • handle the "Check Box" control directly. For example:
    Info(CBOX_MyCheckBox)
See also
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help