ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / TreeView functions
  • Moving an element onto itself
  • Duplicates
  • Priority order for the sort
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Moves an element (leaf or node) in a TreeView control. All branches issued from this element are also moved.
Example of TreeView control:
Vocabulary linked to a TreeView control
Example
// Move the "Pineapple" leaf into the "Starters" node
// in the "TREE_TVRecipe" control
Res = TreeMoveItem(TREE_RecipeTV, ...
	"Recipes" + TAB + "Desserts" + TAB + "Fruit salad", ...
	"Recipes" + TAB + "Starters", tvFirst)
Syntax
<Result> = TreeMoveItem(<TreeView control> , <Source element> , <Destination element> [, <Sort mode>])
<Result>: Boolean
  • True if the element was moved,
  • False otherwise.
<TreeView control>: Control name
Name of the TreeView control to be used.
<Source element>: Character string
Path of element (leaf or node) to move. This element and all the branches issued from this element will be moved. This parameter has the following format:
"<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
If there are two elements with the same name in the path, you can add the IDs of the elements (after their names using TreeID).
<Destination element>: Character string
Path of element (leaf or node) corresponding to the new "parent" node of the moved element. This element must exist. This parameter:
  • has the following format:
    "<Root name>" + TAB + ["<Name of 1st node>" + TAB + ...
    ["<Name of 2nd node>" + TAB + [...]]]"<Leaf name>"
    If there are two elements with the same name in the path, you can add the IDs of the elements (after their names using TreeID).
  • corresponds to the NULL constant if the "parent" node is the root of the TreeView control.
<Sort mode>: Optional constant (or combination of constants)
Position of the moved element in relation to the "child" elements of the destination node.
tvAcceptDuplicateThe duplicates are accepted (two elements on the same level can have the same name). The moved element is inserted in alphabetical order, among the elements of the same level.
tvAlphaSort
(Default value)
The moved element is sorted in alphabetical order, among the elements of the same level.
tvFirstThe element is moved to the first position of the level.
tvLastThe element is moved to the last position of the level.
Remarks

Moving an element onto itself

An element cannot be moved onto itself or onto one of its children. In this case, TreeMoveItem returns False and the element is not moved.

Duplicates

Two cases may occur if the <Destination element> already contains a child with the same name as the <Source element>:
  • If the duplicates are accepted (tvAcceptDuplicate constant), the move is performed as usual. TreeMoveItem returns True.
  • If duplicates are not accepted, TreeMoveItem returns False. The element is not moved.
If the <Source element> contains duplicates with identifiers, these duplicates are moved and keep the same identifier.

Priority order for the sort

The priority order of parameters for the add mode is as follows:
  • tvFirst
  • tvLast
  • tvAlphaSort
For example, in tvFirst + tvLast + tvAlphaSort, only the tvFirst constant is taken into account and run.
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/26/2024

Send a report | Local help