TreeView, Drag & Drop 
Author Message
 TreeView, Drag & Drop

Hello!

I would like to realize a sophisticated drag and drop in a
TreeView similar to the behaviour in the explorer.
I am using the Microsoft Windows Common Controls 6.0 (SP3).

Do anybody already have experiences with this subject?
Where can I find some useful code that really helps?

I already tried some code snippets but I'm not satisfied
with the results. A major problem seems to be the fact,
that the TreeView do not fire the MouseUp event after
moving to another tree item while holding the mouse
button down.

Thanks for any help,
  Peter



Sat, 22 Jun 2002 03:00:00 GMT  
 TreeView, Drag & Drop
You can find an example of treeview drag and drop at
http://www.mvps.org/btmtz/treeview/

Mike Jones


Quote:
> Hello!

> I would like to realize a sophisticated drag and drop in a
> TreeView similar to the behaviour in the explorer.
> I am using the Microsoft Windows Common Controls 6.0 (SP3).

> Do anybody already have experiences with this subject?
> Where can I find some useful code that really helps?

> I already tried some code snippets but I'm not satisfied
> with the results. A major problem seems to be the fact,
> that the TreeView do not fire the MouseUp event after
> moving to another tree item while holding the mouse
> button down.

> Thanks for any help,
>   Peter



Sat, 22 Jun 2002 03:00:00 GMT  
 TreeView, Drag & Drop
Hello Mike,

I know this example and I think that the whole stuff
on Brad's page is really great.

However there's a little problem. Brad uses the
Microsoft Windows Common Controls 5.0 (SP2) in his sample
that is working well.

But the Microsoft Windows Common Controls 6.0 (SP3) that
I'm using (for some specific reasons) seems to have
a bug with the MouseUp event. So Brad's code is no
longer working with this current version of the control.

I'm still trying to find a workaround. I think I have to
forward the question directly to Microsoft.

Thanks for your help.

  Peter



Sat, 22 Jun 2002 03:00:00 GMT  
 TreeView, Drag & Drop
Hi!

Try this website: http://www.mvps.org/btmtz/

Lots of samples on how to drag and drop treenodes like in Windows Explorer!





Sat, 22 Jun 2002 03:00:00 GMT  
 TreeView, Drag & Drop
Peter,

Quote:
>But the Microsoft Windows Common Controls 6.0 (SP3) that
>I'm using (for some specific reasons) seems to have
>a bug with the MouseUp event. So Brad's code is no
>longer working with this current version of the control.

Interesting, hadn't seen that before, but do now. Without
fully digging into it and determining the cause of this new
behavior (which I suspect as you do is a SP3 Mscomctl.ocx
bug, the control is fraught with perpetual problems), we
can do a quick little work around that should get the
demo code up and working correctly again. In Form1's
TreeView1_MouseMove event, if you change this:

  If (Button = m_iButton) Then
    If (m_himlDrag = 0) And ((m_nodDrag Is Nothing) = False) Then
      Call BeginDrag
    ElseIf m_himlDrag Then
      Call DoDrag
    End If
  End If

to this:

  If (Button = m_iButton) Then
    If (m_himlDrag = 0) And ((m_nodDrag Is Nothing) = False) Then
      Call BeginDrag
    ElseIf m_himlDrag Then
      Call DoDrag
    End If
  ElseIf m_himlDrag Then   ' <--- new
    Call EndDrag                ' <--- new
  End If

things seem to now work as expected. And thanks for
spotting this.

--
Brad Martinez, http://www.mvps.org
Please direct questions/replies to the newsgroup

Quote:

>Hello Mike,

>I know this example and I think that the whole stuff
>on Brad's page is really great.

>However there's a little problem. Brad uses the
>Microsoft Windows Common Controls 5.0 (SP2) in his sample
>that is working well.

>But the Microsoft Windows Common Controls 6.0 (SP3) that
>I'm using (for some specific reasons) seems to have
>a bug with the MouseUp event. So Brad's code is no
>longer working with this current version of the control.

>I'm still trying to find a workaround. I think I have to
>forward the question directly to Microsoft.

>Thanks for your help.

>  Peter



Sun, 23 Jun 2002 03:00:00 GMT  
 TreeView, Drag & Drop
Brad,

I have looked at this sample in your page and it is a great one but a little
thing I have noted is that the image being dragged isn't destroyed when a
mouseup event occurs over a scrollbar. I don't have any idea to solve this
problem. Thanks for any help.

Pedro Paulo dos Santos



Thu, 11 Jul 2002 03:00:00 GMT  
 TreeView, Drag & Drop
Brad,
excuse me. Your sample is working well. I have made a modification to drag
from another control to the treeview and the problem raised from that
modification.

Pedro Paulo dos Santos



Quote:
> Brad,

> I have looked at this sample in your page and it is a great one but a
little
> thing I have noted is that the image being dragged isn't destroyed when a
> mouseup event occurs over a scrollbar. I don't have any idea to solve this
> problem. Thanks for any help.

> Pedro Paulo dos Santos



Thu, 11 Jul 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. TreeView Drag & Drop

2. Treeview - Drag & Drop

3. TreeView, drag & drop, and OLEStartDrag

4. Treeview Drag & Drop

5. Drag & Drop with TreeView control

6. ole drag&drop of file from an activex/ treeview headache

7. TreeView + ListView +Drag&Drop

8. Drag&Drop from NT Explorer to the treeview control

9. Drag&Drop in treeview

10. TreeView with Drag & Drop

11. Drag&Drop in Treeview with HitTest and DropHighlight

12. Drag & Drop in TreeView

 

 
Powered by phpBB® Forum Software