CM MOVETREE
This message is used to move a record to a new parent in the container control.
- Note
- ; If the CCS_MINIRECORDCORE style bit is specified when a container control is created, then MINIRECORDCORE should be used instead of RECORDCORE, and PMINIRECORDCORE should be used instead of PRECORDCORE in all applicable data structures and messages.
Syntax
param1 PTREEMOVE pTreeMove; /* Pointer to a TREEMOVE structure. */ param2 ULONG Reserved; /* Reserved value, must be 0. */
Parameters
- pTreeMove (PTREEMOVE) - Input
- Pointer to a TREEMOVE structure. See TREEMOVE for definitions of this structure's fields as they apply to the CM_MOVETREE message.
- Reserved (ULONG) - Input
- Reserved value, must be 0.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Record and associated subtrees were moved successfully.
- FALSE: Error occurred, and tree structure remains unchanged.
Remarks
This message is used to change the parent of a record in the container control. The fields of the TREEMOVE structure describe the record to be moved, the record to become its new parent, and where to insert the record relative to other records with the same parent.
If the preccNewParent field of the TREEMOVE structure is NULL, the record being moved is moved to the root level; otherwise, it is moved to preccNewParent. The pRecordOrder field of the TREEMOVE structure determines where the record being moved is placed relative to other records with the same parent (the one specified by preccNewParent). If flMoveSiblings of the TREEMOVE structure is TRUE, all siblings that follow the record being moved (preccMove) are moved to the new parent as well. Siblings that precede preccMove are not moved regardless of the value of the flMoveSiblings field. For normal Tree Move operations, the flMoveSiblings field of the TREEMOVE structure should be set to FALSE.
WinGetLastError returns PMERR_INVALID_PARAMETERS if any of the following illegal combinations are used:
- flMoveSiblings is either the first or last root level record in the container, and the flMoveSiblings flag is TRUE.
- preccMove is a root level record, and preccNewParent is currently one of its children.
- pRecordOrder is a pointer to a RECORDCORE structure (not CMA_FIRST or CMA_LAST) that does not exist in the list of children of the new parent.
- preccNewParent is NULL, and pRecordOrder is not a root level record.
For example, the following tree contains two parents, each with three children:
Parent A │ ├──────────Child A1 │ ├──────────Child A2 │ ├──────────Child A3 │ Parent B │ ├──────────Child B1 │ ├──────────Child B2 │ ├──────────Child B3
If preccMove is Child A2, preccNewParent is Parent B, pRecordOrder = CMA_LAST and flMoveSiblings = TRUE, after the Tree Move operation, the new tree structure is as follows:
Parent A │ ├──────────Child A1 │ Parent B │ ├──────────Child B1 │ ├──────────Child B2 │ ├──────────Child B3 │ ├──────────Child A2 │ ├──────────Child A3
Default Processing
The default window procedure does not expect to receive this message and, therefore, takes no action on it other than to return FALSE.