more micro tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
49
wxPython/tests/test_griddrag.py
Normal file
49
wxPython/tests/test_griddrag.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import wx
|
||||
import wx.grid
|
||||
##import os; print os.getpid(); raw_input("press enter...")
|
||||
|
||||
class TestFrame(wx.Frame):
|
||||
def __init__(self, *args, **kw):
|
||||
wx.Frame.__init__(self, *args, **kw)
|
||||
self.grid = wx.grid.Grid(self)
|
||||
self.grid.CreateGrid(10,10)
|
||||
self.grid.EnableDragCell(True)
|
||||
self.grid.Bind(wx.grid.EVT_GRID_CELL_BEGIN_DRAG, self.OnBeginDrag)
|
||||
#self.grid.GetGridWindow().Bind(wx.EVT_MOTION, self.OnMouseDrag)
|
||||
|
||||
|
||||
def OnBeginDrag(self, evt):
|
||||
print "OnBeginDrag"
|
||||
|
||||
# The grid window has the mouse captured when this event is sent??
|
||||
if self.grid.GetGridWindow().HasCapture():
|
||||
print "Releasing capture"
|
||||
self.grid.GetGridWindow().ReleaseMouse()
|
||||
|
||||
src = wx.DropSource(self.grid)
|
||||
data = wx.TextDataObject("This is a test")
|
||||
src.SetData(data)
|
||||
result = src.DoDragDrop()
|
||||
print "result = %d" % result
|
||||
|
||||
|
||||
def OnMouseDrag(self, evt):
|
||||
if not evt.Dragging():
|
||||
evt.Skip()
|
||||
return
|
||||
print "OnMouseDrag"
|
||||
src = wx.DropSource(self.grid)
|
||||
data = wx.TextDataObject("This is a test")
|
||||
src.SetData(data)
|
||||
result = src.DoDragDrop()
|
||||
print "result = %d" % result
|
||||
|
||||
|
||||
from wx.lib.mixins.inspect import InspectableApp
|
||||
|
||||
app = InspectableApp(False)
|
||||
app.Init()
|
||||
frm = TestFrame(None, title="EVT_GRID_CELL_BEGIN_DRAG")
|
||||
frm.Show()
|
||||
app.MainLoop()
|
||||
|
Reference in New Issue
Block a user