M
Marco G.
I found that the HitText function from the Treeview ActiveX Control does not return the proper node when using in Microsoft Word (or Excel). The same control does work propely in Microsoft Access. This makes it difficult for make a drag-and-drop function in a userform in Word.
Does somebody have a drag-and-drop function for the Treeview control, including control scrolling? All the examples available on the wed are based on VB or Access.
When implementing the Treeview control (from the Microsoft Command Controls library) in Word or Excel there is automatically a linked made with an undocumented library called F3Dynamic. Does this library interfere with the Treeview control? What is the use of the F3Dynamic library by the way, and why is it not documented?
I used MS Word version 2000 (9.0.3821 SR-1).
Create a form in WinWord named Userform1 and add the following controls:
one Treeview (name: Treeview1)
three Labels (name: LabelX, LabelY, LabelNode)
The Treeview control is from the Microsoft Windows Common Controls libary version 6.0 (SP3)
Add the following code to Userform1:
------------
Private Sub TreeView1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
Dim PointedNode As Node
Set PointedNode = TreeView1.HitTest(x, y)
LabelX.Caption = Str(x)
LabelY.Caption = Str(y)
If PointedNode Is Nothing Then
LabelNode = ""
Else
LabelNode = PointedNode.Text
End If
End Sub
Private Sub UserForm_Initialize()
With TreeView1.Nodes
.Add , , , "node 1"
.Add , , , "node 2"
.Add , , , "node 3"
End With
End Sub
Does somebody have a drag-and-drop function for the Treeview control, including control scrolling? All the examples available on the wed are based on VB or Access.
When implementing the Treeview control (from the Microsoft Command Controls library) in Word or Excel there is automatically a linked made with an undocumented library called F3Dynamic. Does this library interfere with the Treeview control? What is the use of the F3Dynamic library by the way, and why is it not documented?
I used MS Word version 2000 (9.0.3821 SR-1).
Create a form in WinWord named Userform1 and add the following controls:
one Treeview (name: Treeview1)
three Labels (name: LabelX, LabelY, LabelNode)
The Treeview control is from the Microsoft Windows Common Controls libary version 6.0 (SP3)
Add the following code to Userform1:
------------
Private Sub TreeView1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
Dim PointedNode As Node
Set PointedNode = TreeView1.HitTest(x, y)
LabelX.Caption = Str(x)
LabelY.Caption = Str(y)
If PointedNode Is Nothing Then
LabelNode = ""
Else
LabelNode = PointedNode.Text
End If
End Sub
Private Sub UserForm_Initialize()
With TreeView1.Nodes
.Add , , , "node 1"
.Add , , , "node 2"
.Add , , , "node 3"
End With
End Sub