PC SOFT

WINDEV的在线文档

  • Overview
  • Initialize or modify 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
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Handling a control by programming in a report

Overview
All the report controls can be handled by programming. To do so, use the variable of the control 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 Handling an element in a WLanguage process for more details.

Initialize or modify 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
MyCalculatedControlProduct.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

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文件当前目录()+"\MyImage.BMP"
    IMG_MyImageImagePath

Retrieving the value of a control

To retrieve the content of a control:

  • a simple assignment is sufficient. For example:
    CurrentContentCalculatedControlMyCalculatedControl
  • handle the control directly. For example:
    如果MyCalculatedControl大于10,那么...
  • use ..值.

Special case: Static control

To retrieve the content of a "Static" control:
  • a simple assignment is sufficient. For example:
  • handle the "Static" control directly. For example:
  • use ..值 or ..标签.

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:
  • (or 1) if the box is checked
  • (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:
    如果CBOX_MyCheckBox,那么
    // MyControl becomes visible
    MyControl..可见=
    结束
  • handle the "Check Box" control directly. For example:
    信息CBOX_MyCheckBox