]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/mixins/grid.py
cleanup - reformatting
[wxWidgets.git] / wxPython / wx / lib / mixins / grid.py
1 #----------------------------------------------------------------------------
2 # Name: wx.lib.mixins.grid
3 # Purpose: Helpful mix-in classes for wx.Grid
4 #
5 # Author: Robin Dunn
6 #
7 # Created: 5-June-2001
8 # RCS-ID: $Id$
9 # Copyright: (c) 2001 by Total Control Software
10 # Licence: wxWindows license
11 #----------------------------------------------------------------------------
12 # 12/14/2003 - Jeff Grimmett (grimmtooth@softhome.net)
13 #
14 # o 2.5 compatability update.
15 # o Untested
16 #
17 # 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
18 #
19 # o wxGridAutoEditMixin -> GridAutoEditMixin
20 #
21
22 import wx
23 import wx.grid
24
25 #----------------------------------------------------------------------------
26
27
28 class GridAutoEditMixin:
29 """A mix-in class that automatically enables the grid edit control when
30 a cell is selected.
31
32 If your class hooks EVT_GRID_SELECT_CELL be sure to call event.Skip so
33 this handler will be called too.
34 """
35
36 def __init__(self):
37 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.__OnSelectCell)
38
39
40 def __DoEnableEdit(self):
41 if self.CanEnableCellControl():
42 self.EnableCellEditControl()
43
44
45 def __OnSelectCell(self, evt):
46 wx.CallAfter(self.__DoEnableEdit)
47 evt.Skip()
48