PC SOFT

WINDEV的在线文档

  • Overview
  • Initializing a Listview control
  • Initializing an element
  • Filling a ListView control
  • Selecting an element in a Listview control
  • Selecting the element of the row whose subsctript is
  • Positioning on the last element of the Listview control
  • Retrieving the element selected in the Listview control
  • Retrieving the subscript of the selected element
  • Retrieving the value of the selected element
  • Properties specific to the management of Listview 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 ListView control by programming

Overview
WinDev enables you to handle a ListView control by programming. To do so, use the variable of the ListView control in the code. This variable is a numeric variable.

The variable of the ListView control:

  • corresponds to the name of the ListView control.
  • is initialized with the subscript of the element selected in the Listview.
Note: To handle a Listview element not associated with any stored item, use the following syntax:

<ListView Name> [ <Element Subscript>]

Initializing a Listview control

Initializing an element

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

列表添加LSV_ListView1"Sun""C:\IMG\Sun.JPG"
列表添加LSV_ListView1Photo

Filling a ListView control

To initialize a Listview control, an iteration loop must be used to initialize all the control elements.

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

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

Selecting an element in a Listview control

Selecting the element of the row whose subsctript is <Subscript>

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

Positioning on the last element of the Listview control

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

Retrieving the element selected in the Listview 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 = <ListView Name>
Subscript = 列表选定元素(ListView Name)

Note: For multi-selectionListview controls, 列表选定元素 lets you retrieve all 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列表选定元素LSV_ListView1Rank
如果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 = <ListView Name>
<Variable> = <ListName>[Subscript]

  • Syntax 2:
<Variable> = <ListViewName>[<ListView Name>]

<Variable> = <ListView Name>..显示值
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 Listview control, use the ..内存值 property.

Properties specific to the management of Listview controls
The following properties are used to manage the Listview controls:
Any type of Listview
内存Used to find out whether the specified control is a memory or browsing Listview control.
图片列表模式Changes the display mode of the Listview control (listview mode, list box mode, panorama mode).
数目Used to find out the number of rows in a Listview control.
垂直方向Used to find out and modify the orientation of a Listview control.
填充类型Used to find out how a Listview control is filled (file, memory, variable).
显示值Used to find out the value of the current row or the value of a specific row in the Listview control.
Used to find out whether a Listview control is empty.
Memory listviews only
已排序Used to find out whether a memory Listview control is sorted and to sort a memory Listview control (according to the captions of the elements).
Browsing listviews only
文件浏览Enables you to find out and modify the file or query used to display the records in the browsing listviews.
自动浏览Used to find out whether a browse performed in a browsing Listview control is an automatic browse or a programmed browse.
字段显示Enables you to identify or modify the item corresponding to the caption displayed in a Listview control.
字段显示图片Used to find out and modify the item corresponding to the image displayed in a Listview control.
字段记忆Used to find out and modify the stored item of a Listview control.
字段浏览Allows you to find out and modify the item used for the automatic browse of Listview controls.

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