-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodMoveNode.bas
49 lines (39 loc) · 1.01 KB
/
modMoveNode.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Attribute VB_Name = "modMoveNode"
Option Explicit
Function MoveNode(tvwTree As TreeView, tvwNode As Node, Optional MoveUp As Boolean = True) As Boolean
Dim tmpNode As New clsNode
Dim tvwNodeKey
Dim MoveKey
Dim SelectedKey
Dim Rel As TreeRelationshipConstants
On Error GoTo MoveNodeError
tvwNodeKey = tvwNode.Key
tmpNode.CopyNode tvwNode
If MoveUp Then
If Not tvwNode.Previous Is Nothing Then
MoveKey = tvwNode.Previous.Key
Rel = tvwPrevious
Else
MoveNode = False
Exit Function
End If
Else
If Not tvwNode.Next Is Nothing Then
MoveKey = tvwNode.Next.Key
Rel = tvwNext
Else
MoveNode = False
Exit Function
End If
End If
tvwTree.Nodes.Remove tvwNodeKey
tmpNode.ResetNode tvwTree, MoveKey, Rel
tvwTree.SelectedItem = tvwTree.Nodes(tvwNodeKey)
tvwTree.SelectedItem.EnsureVisible
MoveNode = True
On Error GoTo 0
Exit Function
MoveNodeError:
MoveNode = False
On Error GoTo 0
End Function