I agree, drag and drop seems to be a tricky thing. However, if you
veto the event, isn't that the same as ignoring the event. Then,
I think you should be able to do whatever ui operation you need in the
EVT_TREE_BEGIN_DRAG handler. Otherwise, it is a bug, right?
def BeginDrag(self, event):
'''
EVT_TREE_BEGIN_DRAG handler.
'''
self.dragItem = event.GetItem()
event.Veto()
message = wxMessageDialog(self, 'Error', 'Error')
message.Show()
···
On Thu, 25 Mar 2004, David Woods wrote:
In my experience, Drag and Drop is a rather tricky beast in any language.
I would try to avoid using a wxMessageDialog in the middle of a Drag, which
could be quite disruptive to the Drag and drop process. For example, you
have to click on a button in the wxMessageDialog, and to be able to do so,
you've by definition let go of the mouse button, which has terminated your
Drag.Try using the GiveFeedback method in the wxDropSource to alter your cursor,
and if you need to tell your user why a particular Drag failed, you can pop
up a wxMessageDialog after the Drop is attempted. You might be able to use
a Status Bar or something like that if you need to provide additional
information during a Drag, but don't try to use a wxMessageDialog.Also, I've had much better luck with Drag and Drop within a wxTreeCtrl on
Windows than on other platforms. If you are writing something
cross-platform, and you get something reasonable to work on Mac or *nix,
please share your code with me or put it on the Wiki, as it will help me
solve a big problem I will need to tackle in about a month.Hope this helps some.
David Woods
Wisconsin Center for Education Research
University of Wisconsin, Madison-----Original Message-----
From: Susanne Lefvert [mailto:lefvert@mcs.anl.gov]
Sent: Thursday, March 25, 2004 2:28 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wxTree Drag n DropThis also causes the message dialog to hang.
def BeginDrag(self, event):
'''
EVT_TREE_BEGIN_DRAG handler.
'''
self.dragItem = event.GetItem()
message = wxMessageDialog(self, 'Error', 'Error')
message.Show()On Tue, 23 Mar 2004, Robin Dunn wrote:
> Susanne Lefvert wrote:
> > Hello,
> >
> > I am having a problem with wxTreeCtrl and DnD. Following code causes the
> > wxMessageDialog to be unresponsive when opened in the EndDrag callback
> > method.
>
> When the tree item is being dragged the treectrl has the mouse captured,
> and so when you show the dialog it is not able to receive any mouse
> events. If you want to prevent items from being moved in the tree then
> do your check in the EVT_TREE_BEGIN_DRAG handler and just don't call
> event.Allow.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>
>---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org