Questions on Grid cell editor

Hi,

I am using wxPy 2515, Py 233 on Win98.

1) I want to set the cell editor for each column of a grid.
Do I have to call SetCellEditor for every row in that column,
or is there a SetColCellEditor?

2) I tried SetDefaultEditor, thinking that it will set all the cells,
but it did nothing.

3) wx.grid.GridCellFloatEditor() does not allow any parameters.
But the C++ help says:
wxGridCellFloatEditor(int width = -1, int precision = -1)
Is there a way to set the precision of the GridCellFloatEditor?
The default precision is fixed at 6, which gives too many zeros.

4) When the cell editor is shown and I click somewhere outside
using the mouse, the editor should be destroyed. Can this
be done by default by wxPython?

5) Why cant mouse Left/Right Double Click be allowed to
open the cell editor by default by wxPython, as commented
in the demo?

Thanks,
Steven.

Steven Pang wrote:

Hi,

I am using wxPy 2515, Py 233 on Win98.

1) I want to set the cell editor for each column of a grid.
Do I have to call SetCellEditor for every row in that column,
or is there a SetColCellEditor?

You can set the column attributes with SetColAttr, see GridCustEditor.py in the demo.

2) I tried SetDefaultEditor, thinking that it will set all the cells,
but it did nothing.

I think there was a change to the priority that attrs are chosen or something that made this break, but it's been that way for a long time.

3) wx.grid.GridCellFloatEditor() does not allow any parameters.
But the C++ help says:
wxGridCellFloatEditor(int width = -1, int precision = -1)

Oops.

Is there a way to set the precision of the GridCellFloatEditor?
The default precision is fixed at 6, which gives too many zeros.

Call

  editor.SetParameters("%d,%d" % (width, precision))

4) When the cell editor is shown and I click somewhere outside
using the mouse, the editor should be destroyed. Can this
be done by default by wxPython?

Add a EVT_KILL_FOCUS handler to the editor and call

  grid.SaveEditControlValue()
  grid.DisableEditControlValue()

5) Why cant mouse Left/Right Double Click be allowed to
open the cell editor by default by wxPython, as commented
in the demo?

Derive your class from both wx.grid.Grid and also wx.lib.mixins.grid.GridAutoEditMixin.

ยทยทยท

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