CopyTreeItem
int CopyTreeItem (int sourcePanelHandle, int sourceControlID, int sourceItemIndex, int destinationPanelHandle, int destinationControlID, int destinationRelation, int destinationRelativeIndex, int destinationPosition);
Purpose
Copies a tree item and its descendents to another position in the same tree or to a different tree. The position is defined by the destination relative index, the destination relation, and the destination position.
The indices of the existing items at and beyond the insertion point increase by the number of items copied.
The function returns the index of the copied item or an error.
Supported Controls
You can use CopyTreeItem with tree controls.
Parameters
Input | ||||
Name | Type | Description | ||
sourcePanelHandle | int | Handle of the source panel containing the tree item to copy. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel. | ||
sourceControlID | 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 NewCtrl or DuplicateCtrl. This ID refers to the tree control that contains the item to copy. |
||
sourceItemIndex | int | Zero-based index of the source tree item to copy into the destination tree. | ||
destinationPanelHandle | int | The panel that contains the tree into which you want to copy the tree item. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel. | ||
destinationControlID | 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 NewCtrl or DuplicateCtrl. This ID refers to the tree control into which the tree item will be copied. |
||
destinationRelation | int |
Defines whether the copied item will be a child or sibling of the relative item in the destination tree. This parameter is ignored if the destination tree is empty. 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. |
||
destinationRelativeIndex | int |
Identifies the relative of the copied item in the destination tree. The destinationRelation parameter defines whether the item will become a child or sibling of the relative item in the destination tree. This parameter is ignored if the destination tree is empty. |
||
destinationPosition | int |
Defines the position of the copied item in the destination tree. VAL_PREV—The copied item is inserted before the relative item. Valid only for items copied as a sibling. VAL_NEXT—The copied item is inserted after the relative item. Valid only for items copied as a sibling. VAL_FIRST—If the copied item is inserted as a child, it is the first child of the relative index. If the copied item is inserted as a sibling, it is the first sibling of the relative index. VAL_LAST—If the copied item is inserted as a child, it is the last child of the relative index. If the copied item is inserted as a sibling, it is the last sibling of the relative index. This parameter is ignored if the destination tree is empty.
|
Return Value
Name | Type | Description |
copiedItemIndex | int | Returns the index of the copied item in the destination tree. 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
Example
Refer to userint\treecopy.cws for an example of using the CopyTreeItem function.