PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Operating mode on a Combo Box control
  • Multiselection List Box control
  • Managing errors
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
Moves a row or swaps two rows in a List Box or Combo Box control.
Notes:
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Example
// Swap the current row and row 5
ListMoveRow(LIST_List1, rowSelected , 5, amSwap)
// Move the current row to row 3
ListMoveRow(LIST_List1, rowSelected , 3, amMove)
// Swap the current row with the next row
ListMoveLine (LIST_List1, rowSelected, amNext, amSwap)
Syntax

Moving to a specific position Hide the details

<Result> = ListMoveLine(<List Box control> , <Subscript of row to move> , <Subscript of destination row> [, <Operation to perform>])
<Result>: Integer
New subscript of row that was moved.
<List Box control>: Control name
Name of List Box or Combo Box control to use.
If this parameter corresponds to an empty string (""), the control to which the current event belongs will be used.
<Subscript of row to move>: Integer
Position of 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 ListCount or ..Count for example).
To move the row that is currently selected, use the rowSelected constant.
<Subscript of destination row>: Integer
New row position. This position must be included between 1 and the number of rows found in the List Box or Combo Box control (returned by ListCount or ..Count 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 of position that will be performed for the row:
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) is not modified.
This constant can be combined with the amMove and amSwap constants.
amMove
(default value)
The row is moved toward the subscript of destination row.
amSwapThe source and destination rows are swapped.

Moving relatively to the current position Hide the details

<Result> = ListMoveLine(<List Box control> , <Subscript of row to move> , <Relative move> [, <Operation to perform>])
<Result>: Integer
  • New subscript of row that was moved,
  • 0 if an error occurred.
<List Box control>: Control name
Name of List Box control to use.
If this parameter corresponds to an empty string (""), the control to which the current event belongs will be used.
<Subscript of row to move>: Integer
Position of row to move. This position must be included between 1 and the number of rows in the List Box control (returned by ListCount or ..Count for example).
To handle the row that is currently selected, use the rowSelected constant.
<Relative move>: Integer constant
Used to perform a move or a swap on a position relative to the subscript of row to move.
amLastMoves the row to last position.
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).
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
amFirstMoves the row to first position.
amNextMoves the row one position downwards.

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 of position that will be performed for the row:
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) is not modified.
This constant can be combined with the amMove and amSwap constants.
amMove
(default value)
The row is moved toward the subscript of destination row.
amSwapThe source and destination rows are swapped.
Remarks

Operating mode on a Combo Box control

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

Multiselection List Box control

If ListMoveLine is used on a multiselection 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.

Managing errors

Caution: ListMoveLine returns no error code. To find out whether an error was generated by this function, use ErrorInfo associated with the errMessage constant.
Component : wd240obj.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Exemplo ListMoveLine
gn_indice++
IF gn_indice>6 THEN
gn_indice=1
END

ListMoveLine(LIST_List1,rowSelected,gn_indice,amSwap)

--
gn_indice--
IF gn_indice=0 THEN
gn_indice=6
END

ListMoveLine(LIST_List1,rowSelected,gn_indice,amSwap)

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/11/aula-961-curso-windev-listbox-005.html
https://www.youtube.com/watch?v=nyRX7nrKzts
De matos
04 Dec. 2016
Exemplo ListBox Mover Linha

//Codigo Inicializacao janela
// Elimina dados do Listbox
ListDeleteAll(LISTE_programa)
// Ler a tabela de clientes e preenche ListBox
FOR EACH cliente
ListAdd(LISTE_programa,cliente.nome)
END

//Sélection Combo
SWITCH COMBO_selecione
CASE 1
CASE 2
ListMoveLine(LISTE_programa,rowSelected,amNext)
CASE 3
ListMoveLine(LISTE_programa,rowSelected,amPrevious)
CASE 4
ListMoveLine(LISTE_programa,rowSelected,amFirst)
CASE 5
ListMoveLine(LISTE_programa,rowSelected,amLast)
OTHER CASE
END

//Blog com Video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/04/curso-windev-listbox-004-listmoveline.html
De matos AMARILDO
18 Apr. 2016