AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / ¿Cómo proceder? / Programación
  • Overview
  • Method 1: Using the ListSelect function
  • Example
  • Method 2: Using the FOR EACH statement
  • Example
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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 can 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 programmatically.
The "Selección múltiple" option of the List Box control is available in the "UI" tab of the control qdescription window.
The user can perform a multi-selection 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 or no longer any element selected.
  • If ListSelect returns a value greater than 0: this value represents the position of the item selected in the List Box control.
To retrieve the value of the selected element, use the following syntax:
NameListBoxControl[Subscript]
Note: You can find out the number of items selected using the ListSelectCount function. 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
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 13/02/2025

Señalar un error o enviar una sugerencia | Ayuda local