wxGrid and Focus Event

lux luca.tavoletti at gmail.com
Tue Nov 29 14:54:16 EST 2005


Can you try this code?

If you press only the TAB key
the focus go from the TextCtrl to the Grid (I suppose)
but onGridFocus in not called.

any idea?
Luca.


##################

import wx
import wx.grid

app = wx.PySimpleApp()

f = wx.Frame(None, -1, "")
p = wx.Panel(f, -1)
s = wx.BoxSizer(wx.VERTICAL)

t1 = wx.TextCtrl(p)
s.Add(t1)

g = wx.grid.Grid(p, -1)
g.CreateGrid(2, 2)
s.Add(g, 1, wx.EXPAND)

def onGridFocus(evt):
		print "onGridFocus"
		evt.Skip()

def onCellSelected(evt):
		print "onCellSelected"
		evt.Skip()

g.Bind(wx.grid.EVT_GRID_SELECT_CELL, onCellSelected)
g.Bind(wx.EVT_SET_FOCUS, onGridFocus)

p.SetSizer(s)
f.Show()

app.MainLoop()

##################




More information about the Python-list mailing list