Listbox DropObjectOnRow wrong row parameter?

Please see this sample project.
Drag e.g. row 2 to the place of row 1 (drag line between “folder” and “row 1” appears).
The row parameter in the DropObjectOnRow event is 0.
Am I understanding anything wrong here or is this a bug?
In my opinion the row parameter should be 1.

Listbox rows are 0-based, so 0 is row 1 in view.

Please look at the example and follow my steps.

Yes, you return a 0-based value, so you get 0 instead of 1.

No, it returns -1 when you release the drag before folder1… (top of the Listbox).

And I do not understand what happens.

I have to read the Hierarchical Listbox paragraph in the LR.

I found nothing, sorry.

The location parameter may be the issue It’s set to “AfterRow” so the drop should happen after row 0.

You could alter your code to the following to see the different locations that can be passed in:

Select Case location
Case listbox.DropLocations.AfterAllRows
  MsgBox "add row after all rows"
Case listbox.DropLocations.AfterRow
  MsgBox "add row after rowindex = " + CStr(row)
Case listbox.DropLocations.OnControl
  MsgBox "drop occurred ON control"
Case listbox.DropLocations.OnRow
  MsgBox "add row to rowindex = " + CStr(row)
End Select

Works on standard Row and in the original project, if you drop a Row before Row 0, the returned value is -1.
(from inside a hierarchical Row or not: I inserted 3 Rows before the original folder row).

I experienced the very same thing, till I noticed the location parameter as @Jason Parsley points out. Everything works fine after I handled that.