Insure suitable choices of path/drive separator on OS/2.
[wxWidgets.git] / wxPython / wx / lib / mixins / grid.py
CommitLineData
d14a1e28
RD
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#----------------------------------------------------------------------------
1fded56b 12
d14a1e28
RD
13from wxPython import wx, grid
14
15#----------------------------------------------------------------------------
16
17
18class 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()
1fded56b 43