[wxPython] wxGrid SetCellEditor

OK, I'm new to all this, and I'm not having a fun time ... :frowning:

I'm trying to use a wxGrid to enter various types of data. Some cells
have their attributes set to attr_noedit, but for the rest, I'd like
to have them go directly into edit mode when selected. So I have in
part:

      EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
      EVT_IDLE(self,self.OnIdle)

   def OnSelectCell(self, evt):
      self.edit=1
      evt.Skip()

   def OnIdle(self, evt):
      if self.edit==1:
         if self.CanEnableCellControl():
            self.EnableCellEditControl()
         self.edit=0

This works, except where I have previously used:
  self.SetCellEditor(row,k,wxGridCellNumberEditor()) or
  self.SetCellEditor(row,k,wxGridCellFloatEditor())

Here, the self.EnableCellEditControl() doesn't seem to work (the cell
gets selected, but a second click is needed to edit it.

Can anyone shed any light on this?

TIA, Alex

I'm trying to use a wxGrid to enter various types of data. Some cells
have their attributes set to attr_noedit, but for the rest, I'd like
to have them go directly into edit mode when selected.

Nice idea! I think I'll add a mix-in class to wxPython.lib.mixins...

So I have in
part:

      EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
      EVT_IDLE(self,self.OnIdle)

   def OnSelectCell(self, evt):
      self.edit=1
      evt.Skip()

   def OnIdle(self, evt):
      if self.edit==1:
         if self.CanEnableCellControl():
            self.EnableCellEditControl()
         self.edit=0

This works, except where I have previously used:
self.SetCellEditor(row,k,wxGridCellNumberEditor()) or
self.SetCellEditor(row,k,wxGridCellFloatEditor())

Works for me. What platform and version are you on? Do the cells have
valid Number or Float values in them? If not there is an ASSERT that fires
in debug/hybrid mode, maybe there is a side effect of that you are seeing...

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!