thanks, that does it. Here's code should anyone ever run into this again.
pos = wx.GetMousePosition()
treePosition = self.treeCtrl.GetScreenPosition()
treeSize = self.treeCtrl.GetSize()
if pos[0]<treePosition[0] or pos[0]>treePosition[0]+treeSize[0] or pos[1]<treePosition[1] or pos[1]>treePosition[1]+treeSize[1]:
print "out of bounds"
return
you could probably do this with wx.Rectangles too...
D
···
At 12:19 PM 3/21/2007 -0700, you wrote:
Danny Shevitz wrote:
I have discovered a bug in my drag and drop routine for my TreeCtrl.
I have a hidden root tree and have bound to wx.EVT_TREE_END_DRAG.
The problem is that I can't tell apart when I have dragged off the TreeCtrl
entirely or still on the TreeCtrl but below the existing items. In both cases,
if I test the event with,
if event.GetItem():
or
if event.GetItem().IsOk():
of
if event.GetItem()==self.GetRootItem():
all are false regardles of dropping below items or off the TreeCtrl. Yet in terms of interface, they are quite different. If I drop
off the TreeCtrl, I wan to cancel the drop. If I drop below the existing items,
I want to create a new root in the TreeCtrl.
I tried looking at event.GetPoint() but that is always (0,0).You could use wx.GetMousePosition to get the current location of the cursor in screen coordinates, and then convert that to client coordinates of the tree, and then compare to the size of the tree widget.
--
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