Tests for FindItemAtPoint
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,7 +13,9 @@ class TestFrame(wx.Frame):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
wx.Frame.__init__(self, None, -1, "wxGridBagSizer")
|
wx.Frame.__init__(self, None, -1, "wxGridBagSizer")
|
||||||
p = wx.Panel(self, -1)
|
p = wx.Panel(self, -1)
|
||||||
gbs = self.gbs = wx.GridBagSizer()
|
p.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||||
|
|
||||||
|
gbs = self.gbs = wx.GridBagSizer(5, 5)
|
||||||
|
|
||||||
gbs.Add( wx.StaticText(p, -1, gbsDescription),
|
gbs.Add( wx.StaticText(p, -1, gbsDescription),
|
||||||
(0,0), (1,7), wx.ALIGN_CENTER | wx.ALL, 5)
|
(0,0), (1,7), wx.ALIGN_CENTER | wx.ALL, 5)
|
||||||
@@ -58,7 +60,7 @@ class TestFrame(wx.Frame):
|
|||||||
self.Bind(wx.EVT_BUTTON, self.OnMoveButton, moveBtn2)
|
self.Bind(wx.EVT_BUTTON, self.OnMoveButton, moveBtn2)
|
||||||
|
|
||||||
# Add a spacer at the end to ensure some extra space at the bottom
|
# Add a spacer at the end to ensure some extra space at the bottom
|
||||||
gbs.Add((10,10), (14,0))
|
gbs.Add((10,10), (14,7))
|
||||||
|
|
||||||
gbs.AddGrowableRow(3)
|
gbs.AddGrowableRow(3)
|
||||||
gbs.AddGrowableCol(2)
|
gbs.AddGrowableCol(2)
|
||||||
@@ -107,6 +109,15 @@ when compiled in debug mode.""",
|
|||||||
self.gbs.Layout()
|
self.gbs.Layout()
|
||||||
|
|
||||||
|
|
||||||
|
def OnLeftDown(self, evt):
|
||||||
|
pt = evt.GetPosition()
|
||||||
|
item = self.gbs.FindItemAtPoint(pt)
|
||||||
|
if item is None:
|
||||||
|
print "no item at", `pt`
|
||||||
|
else:
|
||||||
|
print "item found: ", `item.GetPos()`, "--", `item.GetSpan()`
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
|
Reference in New Issue
Block a user