wxTree Drag n Drop

Thanks, but that didn't work either :frowning:

Susanne

路路路

On Mon, 29 Mar 2004, Robin Dunn wrote:

Susanne Lefvert wrote:
>
> 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()
>

The only thing that Veto does is set a flag in the event object that is
checked *after* the handler returns. It does *not* turn off the DnD
operation at that moment. Perhaps this would be better?

   def BeginDrag(self, event):
         '''
         EVT_TREE_BEGIN_DRAG handler.
         '''
           
         self.dragItem = event.GetItem()
         event.Veto()
         wxCallAfter(self.ShowErrorDlg)

   def ShowErrorDlg(self):
         message = wxMessageDialog(self, 'Error', 'Error')
         message.Show()

--
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