PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Initializing a ListView control
  • Initializing an item
  • Filling a ListView control
  • Selecting an element in a ListView control
  • Selecting the element of row whose subscript is
  • Positioning on the last element of ListView control
  • Retrieving the element selected in the ListView control
  • Retrieving the subscript of selected element
  • Retrieving the value of selected element
  • Properties specific to the management of ListView controls
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 ListView control by programming (prefixed syntax)
Overview
WINDEV allows you to handle a ListView control by programming. To do so, use the variable the of ListView control in the code. This variable is a numeric variable.
The variable of ListView control:
  • corresponds to the name of ListView control.
  • is initialized with the subscript of the element selected in the ListView control.
Remark: To handle a ListView element not associated with any stored item, use the following syntax:
<Champ Liste image> [ <Indice de l'élément>]
Initializing a ListView control

Initializing an item

To initialize an element found in a ListView control, use <List Box>.Add.
LSV_ListView1.Add("Sun", "C:\IMG\Sun.JPG")
LSV_ListView1.Add(Photo)

Filling a ListView control

To initialize a ListView control, an iteration loop must be used to initialize all control elements.
Indice est un entier
POUR Indice = <Position Début> A <Position Fin>
<Champ Liste image>.Ajoute(<Valeur>, <Image>)
FIN
i is int
FOR i = 1 TO 52
LSV_ListView1.Add(NAME[i], Image[i])
END
Selecting an element in a ListView control

Selecting the element of row whose subscript is <Subscript>

To select the element found at <Subscript> row, use:
  • the direct assignment:
    <Nom du champ Liste image> = Indice
  • <List Box>.SelectPlus:
    <Champ Liste image>.SelectPlus(<Indice>)

Positioning on the last element of ListView control

To position on the last element of ListView control, use:
Retrieving the element selected in the ListView control

Retrieving the subscript of selected element

To retrieve the subscript of selected element, use:
  • the direct reading of element:
    Indice = <Champ Liste image>
  • <List Box>.Select:
    Indice = <Champ Liste image>.Select()
Remark: For multiselection ListView controls, <List Box>.Select is used to retrieve the selected elements.
// Retrieve the elements of a multiselection ListView control
Rank is int = 0  // selection number
Subscript is int = 0  // subscript of selected element
LOOP
Rank = Rank + 1
Subscript = LSV_ListView1.Select(Rank)
IF Subscript = - 1 THEN BREAK
END

Retrieving the value of selected element

To retrieve the value of selected element, use one of the following syntaxes:
  • Syntax 1:
    Indice est un entier = <Champ Liste image>
    <Variable> = <Champ Liste image>[Indice]
  • Syntax 2:
    <Variable> = <Champ Liste image>[<Champ Liste image>]
  • Syntax 3: DisplayedValue property
    <Variable> = <Champ Liste image>.ValeurAffichée

    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 StoredValue.
Properties specific to the management of ListView controls
The following properties are used to manage the ListView controls:
All types of ListView controls
MemoryAllows you to find out whether the specified control is a memory or browsing ListView control.
ListViewModeChanges the display mode of the ListView control (listview mode, list box mode, panorama mode).
OccurrenceAllows you to find out the number of rows found in a ListView control.
VerticalOrientationAllows you to find out and modify the orientation of a ListView control.
FillTypeAllows you to find out how a ListView control is filled (file, memory, variable).
DisplayedValueAllows you to find out the value of the current row or the value of a specific row in the ListView control.
EmptyAllows you to find out whether a ListView control is empty.
Memory ListView control only
SortedAllows you 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 ListView control only
BrowsedFileAllows you to find out and modify the data file or the query used to display records in the browsing ListView controls.
AutoBrowseAllows you to find out whether a browse performed in a browsing ListView control is an automatic browse or a programmed browse.
DisplayedItemAllows you to identify or modify the item corresponding to the caption displayed in a ListView control.
DisplayedItemImageAllows you to find out and modify the item corresponding to the image displayed in a ListView control.
StoredItemAllows you to find out and modify the stored item of a ListView control.
BrowsedItemAllows you to find out and modify the item used for the automatic browse of ListView controls.

For a complete list of WLanguage properties that can be used with a control of type ListView, see Properties associated with the ListView control.
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment