PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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 is in single-selection.
However, you have the ability to configure the List Box control so that it becomes multiselection. In this case, the user will have the ability to select several elements and to retrieve the selected elements by programming.
The List Box control "multiselection" parameter is available in the "GUI" tab of the control description window.
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 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 version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment