X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..bb56b0a828cad8b9a57dc8270a2aca42afb1903e:/wxPython/demo/wxGridBagSizer.py diff --git a/wxPython/demo/wxGridBagSizer.py b/wxPython/demo/wxGridBagSizer.py index be37635dee..51ebb0c1de 100644 --- a/wxPython/demo/wxGridBagSizer.py +++ b/wxPython/demo/wxGridBagSizer.py @@ -13,12 +13,13 @@ class TestFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "wxGridBagSizer") 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), (0,0), (1,7), wx.ALIGN_CENTER | wx.ALL, 5) - gbs.Add( wx.TextCtrl(p, -1, "pos(1,0)"), (1,0) ) gbs.Add( wx.TextCtrl(p, -1, "pos(1,1)"), (1,1) ) gbs.Add( wx.TextCtrl(p, -1, "pos(2,0)"), (2,0) ) @@ -58,7 +59,7 @@ class TestFrame(wx.Frame): self.Bind(wx.EVT_BUTTON, self.OnMoveButton, moveBtn2) # 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.AddGrowableCol(2) @@ -106,6 +107,15 @@ when compiled in debug mode.""", 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()` + #----------------------------------------------------------------------