Get the index of the parent node where the object was dropped.




When using a tree view, a node can be dropped as a sibling or as a child node to another node. In order to distinguish between the cases, you must use the getLocationParent() method, which returns the index of the parent node of the drop target node returned by getLocationRow().

If both methods return the same row index, you must append the dropped row as a child of the target node. Otherwise, getLocationParent() identifies the parent node where the dropped row has to be added as a child, and getLocationRow() is the index of a sibling node. In the latter case the dropped node must be inserted before the node identified by getLocationRow().

These methods are typically used in the ON DROP block, but can also be used in ON DRAG_OVER to deny the drop depending on the indexes returned; for example, the program might only allow the drop of objects as new children for a given parent node.