DragReorderRows

Is there an event after a dragged line is moved to a new position?

The case is a Listbox with a column that shows an order number value (1,2,3,4) to allow oredering the list by this value.
As i’is possible to drag a line to a new position, the column with that order values should be recalculated after drag from the dragged to the end.
(in this case I reorder the whole list as its only a few line long)

In DragReoderRows event I’ve the following code:

#pragma Unused parentRow
#pragma unused newPosition

dim i as integer

for i = 0 to me.ListCount-1
me.cell(i,5) = str(i+1) // column 5 is the order value
next

return false

This recalculate the column 5 but not for the dragreordered line.
So if at the beginning I’ve ten lines with order column values 1,2,3,4, …, when dragged the 8 line to between 2-3 i got 1,2,8,3,4… in the order column.

I tried return true but then the dragging seems not working at all.

Don’t worry I found a solution.

what was the solution ? got the same prob … :-/

Etienne, could you please describe more precisely what you need ?

I do not remember exactly,
An old utility has the following code (probably there are better code that mine…, but this seems to work):

DragReoderRows
#pragma Unused parentRow

	dim i as integer
	me.SortedColumn= 5
	me.sort
	
	me.Cell(me.ListIndex, 5) = str(newPosition+1)
	
	if newPosition < me.ListIndex then
			
			for i = newPosition to me.listIndex-1
					me.Cell(i,5) = str(i+2)
			next
			
	else
			
			for i = me.listIndex+1 to newPosition
					me.Cell(i,5) = str(i)
			next
			
	end if
	
	me.SortedColumn= 5
	me.sort
	
	return true