beidebenen
asked on
Drag and drop to a specified place i a field using MSComctlLib.TreeCtrl.2
I using a treeview to show some default text an like to use drag an drop to put the default text in a controlbox.
So far so good BUT
I like to drop the default text (for example) inside the text I have already placed in a textcontrol. Who can help me with this problem.
So far so good BUT
I like to drop the default text (for example) inside the text I have already placed in a textcontrol. Who can help me with this problem.
ASKER
I change my design and using now a forms.TextBox.1 and the treeview control. It works but now the value I drag is moving from my treeview list.
Ok it is drag and drop but :)
I like to drop the value and leave the treeview list in order. So I hope someone can tell me what I do wrong.
Ok it is drag and drop but :)
I like to drop the value and leave the treeview list in order. So I hope someone can tell me what I do wrong.
Private Sub TvScript_OLEDragOver(Data As Object, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
Dim nodSelected As Node
Dim nodOver As Node
Dim tv As TreeView
Set tv = Me.TvScript.Object
If tv.SelectedItem Is Nothing Then
'Select a node if one is not selected
Set nodSelected = tv.HitTest(x, y)
If Not nodSelected Is Nothing Then
nodSelected.Selected = True
End If
Else
tv.SelectedItem.Selected = True
End If
End Sub
I'm not sure what you mean by "leave the treeview list in order" ... all your code does is select a Node in your treeview, so I'm not clear what you're asking.
ASKER
First I like to thank you for your comment.
By example:
I click at one of the nodes in the treeview. (the value of the node is "Test")
I like to drag the value to a forms.textbox.1 (because I will drop the value at a specified place in the text)
When I use the default drag and drop actions the first two steps are going right but...
After this action the value, i have draged from the treeview, is no longer available and visible in my treeview.
By example:
I click at one of the nodes in the treeview. (the value of the node is "Test")
I like to drag the value to a forms.textbox.1 (because I will drop the value at a specified place in the text)
When I use the default drag and drop actions the first two steps are going right but...
After this action the value, i have draged from the treeview, is no longer available and visible in my treeview.
So your Drag event FROM the Treeview removes it from the Treeview?
If I'm not mistaken, there are several properties you can set for your Treeview that will allow you to "copy" instead of "cut" ... check the properties and see what you find.
If I'm not mistaken, there are several properties you can set for your Treeview that will allow you to "copy" instead of "cut" ... check the properties and see what you find.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Right ... I knew there were some "option" settings available, but couldn't remember how to invoke them. I don't use the MS treeview anymore, so it's been a while since I've worked with it.
Generally when a suggestion by an Expert helps you to solve your problem you would assign points to that Expert ...
There are some alternatives, but I'm not sure they would work with your Treeview:
www.peterssoftware.com (Drag and Dropper)
How to simulate Drag and Drop:
http://support.microsoft.com/kb/287642
http://accessblog.net/2007/04/drag-and-drop-in-access.html