PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Method 1: Using the ListSelect function
  • Example
  • Method 2: Using the FOR EACH statement
  • Example
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
Overview
A List Box control is used to select and retrieve a single element among the available elements. The list box is single-selection.
However, you have the ability to configure the List Box control so that it becomes multi-selection. In this case, the user will have the ability to select several elements and to retrieve the selected elements by programming.
The "Multi-selection" parameter of List Box control is available in the "GUI" tab of the description window of control.
The user can perform a multiselection via the standard SHIFT and CTRL keys, the arrows and/or the mouse.
Two methods can be used to retrieve the selected elements:
Method 1: Using the ListSelect function
This method consists in performing a browse loop with ListSelect.
A variable representing the rank of the selected element will be incremented from the value 1.
  • If ListSelect returns -1: there is no other selected element.
  • If ListSelect returns a value greater than 0: this value represents the position of the selected element in the List Box control.
To retrieve the value of the selected element, use the following syntax:
NameListBoxControl[Subscript]
Note: To find out the number of selected elements, use ListSelectCount. This allows you to perform a loop with a FOR statement instead of a WHILE statement.

Example

Rank is int
ElementPosition is int
ElementValue is string

Rank = 1
ElementPosition = ListSelect(ListName, Rank)
WHILE ElementPosition<>-1
ElementValue = ListName[ElementPosition]
Rank++
ElementPosition = ListSelect(ListName, Rank)
END
Method 2: Using the FOR EACH statement
This method is used to browse the list of selected elements with a specific FOR EACH statement.

Example

ElementValue is string
FOR EACH SELECTED ROW OF ListName
ElementValue = ListName..DisplayedValue
END
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment