]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/mixins/grid.py
removed second parameter from GetFirstChild calls
[wxWidgets.git] / wxPython / wx / lib / mixins / grid.py
1 #----------------------------------------------------------------------------
2 # Name: wxPython.lib.mixins.grid
3 # Purpose: Helpful mix-in classes for wxGrid
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
13 from wxPython import wx, grid
14
15 #----------------------------------------------------------------------------
16
17
18 class wxGridAutoEditMixin:
19 """A mix-in class that automatically enables the grid edit control when
20 a cell is selected.
21
22 If your class hooks EVT_GRID_SELECT_CELL be sure to call event.Skip so
23 this handler will be called too.
24 """
25
26 def __init__(self):
27 self.__enableEdit = 0
28 wx.EVT_IDLE(self, self.__OnIdle)
29 grid.EVT_GRID_SELECT_CELL(self, self.__OnSelectCell)
30
31
32 def __OnIdle(self, evt):
33 if self.__enableEdit:
34 if self.CanEnableCellControl():
35 self.EnableCellEditControl()
36 self.__enableEdit = 0
37 evt.Skip()
38
39
40 def __OnSelectCell(self, evt):
41 self.__enableEdit = 1
42 evt.Skip()
43