I have a grid with a number of columns,
for each column corresponds to a data type that can
contain (integer, date).
My idea is to define a column for each
editor that can be a wx.TextCtrl or wx.DatePickerCtrl
depending on the data defined for that column.
Will textctrl used for data type string, integer, etc.,
will DatePickerCtrl be used for data type date.
To do this I’m using the method of Create
pyGridCellEditor.
Someone can tell me where I’m going to take
information on the column of the grid on which
Create method is being run?
My assumption is that
information about data types is “tipi”(list) the
whose length is the number of columns
grid.
Follow Pseudo encoding:
…
tipi = [‘date’,‘integer’,…,‘string’]
class CreateCellEditorPy(wx.grid.PyGridCellEditor):
def init(self,frame,tipi):
wx.grid.PyGridCellEditor.init(self)
self.frame = frame
self.tipi = tipi
self.countComma = 0
def Create(self, parent, id, evtHandler):
if tipi[??col] == ‘date’ \
or tipi[??col] == ‘DATE’:
self._tc = wx.DatePickerCtrl(parent, size=(-1,-1),
style = wx.DP_DROPDOWN
wx.DP_SHOWCENTURY
wx.DP_ALLOWNONE )
else:
self._tc = wx.TextCtrl(parent, id, “”,style=wx.TE_PROCESS_TAB)
self._tc.SetInsertionPoint(0)
self.SetControl(self._tc)
if evtHandler:
self._tc.PushEventHandler(evtHandler)
#self._tc.Bind(wx.EVT_CHAR, self.OnChar)
…
···
–
Fabio Spadaro
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en