[wx-dev] #9577: Can't use TreeListCtrl with wxDropSource

wxTrac noreply at wxsite.net
Fri Jun 13 18:47:15 PDT 2008


Ticket URL: <http://trac.wxwidgets.org/ticket/9577>

#9577: Can't use TreeListCtrl with wxDropSource
-----------------------------------------------------+----------------------
 Reporter:  xukosky                                  |       Owner:         
     Type:  defect                                   |      Status:  new    
 Priority:  normal                                   |   Milestone:         
Component:  wxPython                                 |     Version:  2.8.7.1
 Keywords:  TreeListCtrl wxDropSource dnd gtk linux  |   Blockedby:         
    Patch:  0                                        |    Blocking:         
-----------------------------------------------------+----------------------
 Component: TreeListCtrl
 wxPython Version: 2.8.7.1
 Python Version: 2.4.5
 OS: Debian GNU/Linux (wxPython from experimental repository)

 I am trying to drag some files from a TreeListCtrl to a wxTreeCtrl and
 viceversa.
 The drag operation is controlled by using a wxDropSource. Very simple
 code, the same for the TreeListCtrl and the wxTreeCtrl. Just something
 like this (not my code, but a small example):

 def OnDrag(event):
     files = wx.FileDataObject()
     files.AddFile(file)
     dropSource = wx.DropSource(self)
     dropSource.SetData(files)
     drag_result = dropSource.DoDragDrop()

 I have no problems when I drag from the wxTreeCtrl, but when I drag from
 the TreeListCtrl:

 1 - The drag operation is not performed and DoDragDrop returns
 wxDragError. This error only happens sometimes on my "new" computer,
 however, in my "old" computer this error always happens (they have the
 same OS installed).

 2 - While the drag operation starts immediately in the wxTreeCtrl, in the
 TreeListCtrl it suffers a small delay (now, I know it's 3 pixels).

 By simplifying the drag start in the TreeListCtrl's code, I have been able
 to fix both problems. But I have no more OS other than GNU/Linux to
 perform testings. A patch is attached.

 In the patch, the mouse is not longer captured when the drag start, this
 fixes the first problem. There is another mouse capture in
 wxTreeListHeaderWindow::OnMouse, but I haven't modified it.

 Also, to fix the second problem, the following variables are not longer
 used:
 m_dragCount
 m_dragTimer
 I just hope they were not very important...it seems to work for me, by
 now.

 Thank you for reading my ticket :)


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9577>


More information about the wx-dev mailing list