PC SOFT

WINDEV的在线文档

  • Overview
  • Initializing a List Box control
  • Initializing an element
  • Filling a list box
  • Selecting an element in a List Box control
  • Selecting a row
  • Positioning on the last element
  • Retrieving the element selected in a List Box control
  • Retrieving the subscript of the selected element
  • Retrieving the value of the selected element
  • Properties specific to the management of List Box controls
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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 List Box control by programming

Overview
WinDev, WebDev and WinDev Mobile allow you to handle a List Box control by programming. To do so, use the variable of the List Box control in the code. This variable is a numeric variable.

The variable of the List Box control:

  • corresponds to the name of the List Box control.
  • is initialized with the subscript of the element selected in the list box.
The following notation enables you to handle an element found in a list box:

<Name of list box> [<Element subscript>]

Note: Several WLanguage functions are specifically used to manage the List Box controls. See the functions for managing the list boxes for more details.

Initializing a List Box control

Initializing an element

To initialize an element found in a List Box control, use 列表添加.

Note: To modify an element found in a List Box control, use the following syntax:

<List name>[Subscript] = <value>

For example:

// Add elements
列表添加LIST_LIST1"MOORE"
列表添加LIST_LIST1Cust_Name
// Modify elements
LIST_LIST13】="MOORE"

Filling a list box

To initialize a List Box control, all you have to do is use an iteration loop to initialize all the elements of the List Box control.

Subscript is int
FOR Subscript = <Start Position> TO <End Position>
列表添加(<List Name>, <Value>)
END

Example:

i整数型
对于i1直到52
列表添加LIST_LIST1NAMEi】)
结束

Selecting an element in a List Box control

Selecting a row

To select the element found at <Subscript> row, use:
  • the direct assignment:
<List Name> = Subscript
列表选择元素(<List Name>, <Subscript>)

Positioning on the last element

To position on the last element of a List Box control, use:
<List Name>..数目
列表选择元素(<List Name>, <List Name>..数目)
列表元素数目(<List>)

Retrieving the element selected in a List Box control

Retrieving the subscript of the selected element

To retrieve the subscript of the selected element, use:
  • a read operation performed on the element:
Subscript = <List Name>
Subscript = 列表选定元素(<List Name>)

Note: For the multi-selection List Box controls, 列表选定元素 is used to retrieve the selected elements.

// Retrieve the elements from a multi-selection list
Rank整数型0// number of the selection
Subscript整数型0// subscript of the selected element
循环
RankRank+1
Subscript列表选定元素LIST_LIST1Rank
如果Subscript=-1,那么跳出
结束

Retrieving the value of the selected element

To retrieve the value of the selected element, use one of the following syntaxes:

  • Syntax 1:
Subscript is int = <List Name>
<Variable> = <ListName>[Subscript]

  • Syntax 2:
<Variable> = <ListName>[<List Name>]

<Variable> = <ListName>[Subscript]..显示值

Caution: The value stored in programming can differ from the displayed value. To find out the stored value corresponding to one of the rows found in the List Box control, use ..内存值.

Properties specific to the management of List Box controls
The following properties are used to manage the List Box controls:

All types of List Box controls
水平对齐Used to find out and modify the horizontal alignment of the elements found in the List Box control.
行高Used to find out and modify the height of the rows in a List Box control.
内存Used to find out whether the specified control is a memory or browsing List Box control.
数目Used to find out the number of rows in a List Box control.
填充类型Used to find out the method (file, memory or variable) used to fill a Table, List Box, ListView, Combo Box or Looper control.
显示值Used to find out the value of the current row or the value of a specific row in the List Box control.
内存值Used to find out the value currently stored when selecting a row of the List Box control.
Used to find out whether a List Box control is empty.
Memory list boxes only
初始内容Used to find out the initial content of a memory List Box control.
已排序Used to find out whether a memory List Box control is sorted and to sort a memory List Box control.
Browsing list boxes only
文件浏览Allows you to find out and modify the data file or the query used to display records in the browsing List Box controls.
自动浏览Used to find out whether a browse performed in a browsing List Box control is an automatic browse or a programmed browse.
字段显示Used to find out and modify the item displayed in a List Box control.
字段记忆Used to find out and modify the stored item of a List Box control.
字段浏览Allows you to find out and modify the item used for the automatic browse of List Box controls.

To find out the entire list of WLanguage properties that can be used with a List Box control, see Properties associated with the List Box control.