MoveTreeItem

int MoveTreeItem (int panelHandle, int controlID, int itemIndex, int relation, int relativeIndex, int position);

Purpose

Moves an item and its descendents to another position in the tree control. The new position is defined by the relative index, the relation, and the position.

Moving an item changes the indices of the existing items between the original index and the final index of the item to be moved.

The function returns the new index of the moved item or an error.

Parameters

Input
Name Type Description
panelHandle integer Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID integer The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
itemIndex integer Zero-based index of the tree item to move.
relation integer Defines whether the item to be moved will be a child or sibling of the relative item.

You can use the following values:

VAL_CHILD—The item is a child of the relative item.
VAL_SIBLING—The item is a sibling of the relative item.
relativeIndex integer Identifies the new relative of the item to be moved. The relation parameter defines whether the item will become a child or sibling of the relative item.
position integer Defines the new position of the item.

VAL_PREV—The item is moved before the relative item. Valid only for items moved to be a sibling of the relative item.
VAL_NEXT—The item is moved after the relative item. Valid only for items moved to be a sibling of the relative item.
VAL_FIRST—If the item is moved to be a child, it is the first child of the relative index. If the item is moved to be a sibling, it is the first sibling of the relative index.
VAL_LAST—If the item is moved to be a child, it is the last child of the relative index. If the item is moved to be a sibling, it is the last sibling of the relative index.

Return Value

Name Type Description
movedToIndex integer Returns the index of the moved item. Use the index to specify the tree item in subsequent function calls. Negative values indicate that an error occurred.

Code Error Message String
xx Item Index (Success)