PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Handling a control by programming in a report
Overview
All the report controls can be handled by 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)
Note: See Handle an element in a WLanguage process for more details.
Versions 18 and later
iPhone/iPad This feature is now available for the iPhone/iPad applications.
New in version 18
iPhone/iPad This feature is now available for the iPhone/iPad applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
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 by 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 ..Value.

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 ..Value or ..Caption.

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