PC SOFT

WINDEV的在线文档

  • What is an element?
  • Handling an element
  • Handling a second-level element
  • Special cases: Items of a data file or query
  • Handling a third-level element
  • Special cases: Menu options
  • Retrieving the name of an element in the code
  • Overview
  • Retrieving the name of an element by Drag and Drop
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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本地访问

Referring to an element in a WLanguage process

What is an element?
The table below presents the different elements found in an application:

ElementSecond-level elementThird-level element
Window
  • Window controls
  • Window menus
  • Cells of a status bar
  • Controls belonging to a supercontrol or to a toolbar
  • Menu options
  • Table columns
Page
Frameset
  • Page controls
  • Page menus
Table columns
Report
  • Report controls
  • Report blocks
Table columns
QueryQuery items
Data fileItems of a data file

The menu options and the items found in a data file are handled differently. For more details, see Special case: Items and Special case: Menu options.

Note: To simplify the writing of the WLanguage processes, WinDev, WebDev and WinDev Mobile allow you to easily retrieve the name of an element in a code window. See Retrieving the name of an element in the code for more details.

Handling an element
To handle an element (page, window, report, query or file) in a WLanguage process, all you have to do is use the name of this element. This name can be used:
  • in a WLanguage function.
  • with a WLanguage property.
  • by direct assignment.
For example:

// Initialize and run the QRY_CustomerList query
H执行查询QRY_CustomerList

// Modify the number of copies for the RPT_Customer report
RPT_Customer..副本数量=10

// Retrieve the title of the WIN_SearchWin window
ResTitle字符串型WIN_SearchWin

// Retrieve the title of the PAGE_SearchPage page
ResTitle字符串型PAGE_SearchPage

Handling a second-level element
To handle a second-level element (control or menu of a window, control or menu of a page, control or block of a report, ...) in a WLanguage process, you must:
  • use this second-level element directly. This syntax is valid only if this second-level element is handled from the window (or from the report) to which it belongs.
  • use the following notation: "<ElementName>.<Name2ndLevelElement>".
A second-level element can be handled:
  • in a WLanguage function.
  • with a WLanguage property.
  • by direct assignment.
For example:

// Expands the list of the COMBO_FrenchCity combo box
// of the WIN_Customer window
组合框打开COMBO_FrenchCity
// equivalent to: ComboOpen(WIN_Customer.COMBO_FrenchCity)

// Modify the background color of the CtTotalBT control
// in the RPT_Order report
CtTotalBT..背景颜色=浅蓝色
// equivalent to RPT_Order.CtTotalBT..BrushColor = LightBlue

// Initialize the EDT_City edit control of the
// WIN_Customer window from another window
WIN_Customer.EDT_City"Momtpellier"

// Refresh the LOOP_ProductLooper looper
// from the start of looper
重复区域显示LOOP_ProductLooper表格.开始
// equivalent to: LooperDisplay(PAGE_CustomerPage.LOOPER_ProductLooper, taStart)

Special cases: Items of a data file or query

To handle an item found in a data file or in a query by programming, you must:
  • use the name of the item directly. This syntax is valid only if the item is handled by a function or by a property into which the name of the data file or the name of the query to which the item belongs is specified.
  • use the following syntax: "<FileName/ItemName>.<ItemName>".
For example:

// Assign to the ZC item of CUSTOMER file
// the value entered in the EDT_ZipCode control
CUSTOMER.ZCEDT_ZipCode

// Moves to the 2000th record
// of CUSTOMER file according to CUSTNAME item
H读第一个CUSTOMERCUSTNAME
H前进CUSTOMERCUSTNAME1999

Handling a third-level element
To handle a third-level element (control belonging to a supercontrol, control belonging to a toolbar, table column, ...) in a WLanguage process, you must:
  • use the name of this third-level element directly. This syntax is valid only if the following conditions are fulfilled:
    • this third-level element is handled from the second-level element to which it belongs (supercontrol, toolbar or table).
    • no other third-level element uses the same name.
  • use the following notation if the third-level element is used from the window (or from the report) to which it belongs: "<Name2ndLevelElement>.<Name3rdLevelElement>".
  • use the following notation if the third-level element is handled from another window (or from another report): "<ElementName>.<Name2ndLevelElement>.<Name3rdLevelElement>".
A third-level element can be handled:
  • in a WLanguage function.
  • with a WLanguage property.
  • by direct assignment.
For example:

// Modify the width of COL_CustomerName column
// No other COL_CustomerName column is found in the window
COL_CustomerName..宽度+=10

// Modify the maximum number of characters in the EDT_Font control
// belonging to the SC_SctStyle supercontrol from the supercontrol window
SC_SctStyle.EDT_Font..大小+=10

// Modify the height of the EDT_Font control belonging to the
// BAR_Style toolbar from another window
WIN_Customer.BAR_Style.EDT_Font..高度+=10

WinDevWindows用户代码(MCU)

Special cases: Menu options

To handle a menu option by programming, you must:
  • use the name of the option directly. This syntax is valid only if the menu option is handled from the menu or from the window associated with the menu.
  • use one of the following syntaxes: "<WindowName>.<OptionName>" or "<WindowName>.<MenuName>.<OptionName>".

For example:

// Change the color of the font for the OPT_CustomerForm option
// of the MENU_Customer menu from the window of this menu
OPT_CustomerForm..颜色=深蓝色

// Change the color of the font for the OPT_CustomerForm option
// of the MENU_Customer menu from another window
WIN_Customer.MENU_Customer.OPT_CustomerForm..颜色=深蓝色
// equivalent to: WIN_Customer.OPT_CustomerForm..Color = DarkBlue

Retrieving the name of an element in the code

Overview

To retrieve the name of an element (regardless of its level) in the code:

Retrieving the name of an element by Drag and Drop

To retrieve the name of an element by Drag and Drop:
  1. Select the element whose name must be retrieved:
  2. Keep the left mouse button down while moving the element:
  3. Release the mouse button at the location where the name of the element should be used. The name of the dropped element is displayed.