Admin Production ni-theme
Current Publication

MoveTreeItem

LabWindows/CVI

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 relativeIndex, the relation, and the position parameters.

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.

Supported Controls

You can use MoveTreeItem with tree controls.

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int 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 functions such as NewCtrl and DuplicateCtrl.
itemIndex int Zero-based index of the tree item to move.
relation int 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 moved item is a child of the target item.
VAL_SIBLING—The moved item is a sibling of the target item.
relativeIndex int Identifies the target item to which the moved item attaches. The relation parameter defines whether the moved item will become a child or sibling of the target item.
position int Defines the new position of the item.

VAL_PREV—The moved item is positioned before the target item. Valid only for moved items where relation is set to VAL_SIBLING.
VAL_NEXT—The moved item positioned after the target item. Valid only for moved items where relation is set to VAL_SIBLING.
VAL_FIRST—If position is set to VAL_FIRST and relation is set to VAL_CHILD, the moved item becomes the first child of the target item. If relation is set to VAL_SIBLING instead, the moved item becomes the first sibling of the target item.
VAL_LAST—If position is set to VAL_LAST and relation is set to VAL_CHILD, the moved item becomes the last child of the target item. If relation set to VAL_SIBLING instead, the moved item becomes the last sibling of the target item.

Note Note  To optimize tree control performance, move child items to a position where they do not have subsequent siblings.

Return Value

Name Type Description
movedToIndex int 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.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 7.0 and later