This is the result:
- Code: Select all Expand view RUN
#include "FiveWin.ch"
function Main()
local oDlg, oBrw, aData
aData := { ;
{ "Item 1", "Codigo 1", "Producto 1", 10, "Uni 1", 100, 5, 95 }, ;
{ "Item 2", "Codigo 2", "Producto 2", 20, "Uni 2", 200, 10, 190 }, ;
{ "Item 3", "Codigo 3", "Producto 3", 30, "Uni 3", 300, 15, 285 } ;
}
DEFINE DIALOG oDlg TITLE "Reordenar filas con Drag & Drop" SIZE 800, 400
@ 10, 10 XBROWSE oBrw ARRAY aData OF oDlg ;
COLUMNS { 1, 2, 3, 4, 5, 6, 7, 8 } ;
HEADERS { "Item", "Codigo", "Nombre del producto", "Cantid", "Uni", "Pr.Unit", "Dscto", "Importe" } ;
COLSIZES { 100, 100, 200, 100, 50, 100, 100, 100 } ;
CELL LINES NOBORDER
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lAllowRowSizing := .F.
oBrw:lAllowColSwapping := .F.
// Habilitar Drag & Drop
oBrw:lDragDrop := .T.
oBrw:bDragBegin := { |nRow| oBrw:nDragRow := nRow }
oBrw:bDragEnd := { |nRow| ReorderRows( oBrw, nRow ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
function ReorderRows( oBrw, nRow )
local aTemp
if oBrw:nDragRow != nRow
aTemp := oBrw:aArrayData[ oBrw:nDragRow ]
ADel( oBrw:aArrayData, oBrw:nDragRow )
AIns( oBrw:aArrayData, nRow, aTemp )
oBrw:Refresh()
endif
return nil
It uses some methods that do not exist (unless the IA read the future)
- Code: Select all Expand view RUN
// Habilitar Drag & Drop
oBrw:lDragDrop := .T.
oBrw:bDragBegin := { |nRow| oBrw:nDragRow := nRow }
oBrw:bDragEnd := { |nRow| ReorderRows( oBrw, nRow ) }
To Mr. Rao: Is there a way to get this functionality ?