ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / List Box functions
  • Operating mode on a Combo Box control
  • Multi-selection List Box control
  • Error management
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Moves a row or swaps two rows in a List Box or Combo Box control.
Remarks:
Example
// Echange la ligne en cours et la ligne 5
LISTE_Liste1.DéplaceLigne(rowSelected, 5, amSwap)
// Déplace la ligne en cours Ã  la ligne 3
LISTE_Liste1.DéplaceLigne(rowSelected, 3, amMove)
// Echange la ligne en cours avec la ligne suivante
LISTE_Liste1.DéplaceLigne(rowSelected, amNext, amSwap)
Syntax

Moving to a specific position Hide the details

<Result> = <List Box control>.MoveLine(<Index of row to move> , <Destination row index> [, <Operation to perform>])
<Result>: Integer
New index of the row that was moved.
<List Box control>: Control name
Name of the List Box or Combo Box control to be used.
<Index of row to move>: Integer
Position of the row to move. This position must be included between 1 and the number of rows found in the List Box or Combo Box control (returned by <List Box>.Count or Occurrence for example).
To move the row that is currently selected, use the rowSelected constant.
<Destination row index>: Integer
New row position. This position must be between 1 and the number of rows in the List Box or Combo Box control (returned by <List Box>.Count or Occurrence, for example). A fatal error occurs if this parameter is not valid.
To handle the row that is currently selected, use the rowSelected constant.
<Operation to perform>: Optional Integer constant (or combination of constants)
Change row position:
amDisplayDestinationThe modified row is displayed in the List Box control (or Combo Box). An automatic scroll of the rows is performed if necessary to display the modified row. The selected row (selection bar) does not change.
This constant can be combined with the amMove and amSwap constants.
amMove
(default value)
Moves the row to the index of the destination row.
amSwapThe source and destination rows are swapped.

Moving relatively to the current position Hide the details

<Result> = <List Box control>.MoveLine(<Index of row to move> , <Relative move> [, <Operation to perform>])
<Result>: Integer
  • New index of the row that was moved,
  • 0 if an error occurs.
<List Box control>: Control name
Name of List Box control to use.
<Index of row to move>: Integer
Position of the row to move. This position must be included between 1 and the number of rows in the List Box control (returned by <List Box>.Count or Occurrence for example).
To handle the row that is currently selected, use the rowSelected constant.
<Relative move>: Integer constant
Used to move or a swap to a position relative to the index of the row to move.
amFirstMoves the row to the first position.
amLastMoves the row to the last position.
amNextMoves the row one position downwards.
amNextPageMoves the row one page to the bottom (a page corresponds to the number of rows that can be simultaneously displayed in the List Box control).
amPreviousMoves the row one position upwards.
amPreviousPageMoves the row one page to the top (a page corresponds to the number of rows that can be simultaneously displayed in the List Box control).

If this parameter is invalid (amPrevious used on the first row of List Box control for example), the row is moved "to the nearest" position.
<Operation to perform>: Optional Integer constant (or combination of constants)
Change row position:
amDisplayDestinationThe modified row is displayed in the List Box control. An automatic scroll of the rows is performed if necessary to display the modified row. The selected row (selection bar) does not change.
This constant can be combined with the amMove and amSwap constants.
amMove
(default value)
Moves the row to the index of the destination row.
amSwapThe source and destination rows are swapped.
Remarks

Operating mode on a Combo Box control

When <List Box>.MoveLine is used on a Combo Box control, the selected element remains the same. The index of the element selected in the drop-down list (i.e. the value returned by the Combo Box control) is modified.

Multi-selection List Box control

If <List Box>.MoveLine is used on a multi-selection List Box control:
  • when moving rows (amMove constant): all selected rows will be moved.
  • when swapping rows (amSwap constant): only the first row will be swapped.
  • the rowSelected constant cannot be used. Otherwise, a fatal error occurs and no row is moved.

Error management

Caution: <List Box>.MoveLine returns no error code. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
Component: wd300obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/21/2023

Send a report | Local help