# SetActiveTreeItem

int SetActiveTreeItem (int panelHandle, int controlID, int itemIndex, int selectionEffect);

## Purpose

Sets the active item of a tree control. If the tree is in multiple selection mode, the effect on the selection is determined by the selectionEffect parameter.

## 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.
selectionEffect | integer | Defines the effect on the selection state of the tree items.
| Note This parameter is ignored if the tree is not in multiple selection mode.
VAL_NO_SELECTION_EFFECT—no selection change. VAL_TOGGLE_SELECTION_OF_ITEM—toggle the selection of the new active item. VAL_ADD_ITEM_TO_SELECTION—select the new active item. VAL_ADD_INTERVAL_TO_SELECTION—select all items between the old active item and the new active item. VAL_REPLACE_SELECTION_WITH_ITEM—deselect all items and leave only the new active item selected.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success