[wxPython-users] wx.GridCellChoiceEditor
Robin Dunn
robin at alldunn.com
Mon Feb 4 10:50:33 PST 2008
Mark Erbaugh wrote:
> I have a grid with a GridCellChioceEditor on a grid that uses a
> GridTable (PyGridTableBase descendant) It appears that the SetValue
> method of the grid table is not called until the user clicks on another
> grid cell. It's not called when the focus leaves the grid entirely.
>
> The grid is on a frame with a 'save' button and is used to edit a
> database table. If the user changes the value for the column with the
> GridCellChoiceEditor (using the drop down list) and clicks on the 'save'
> button, the new value is not written to the database. However, if the
> user changes the value and then clicks on another cell before clicking
> the 'save' button, the new value is written. It seems as if the change
> is held in the CellEditor.
Correct. The data is not written to the table until the editor is
dismissed, because up until that time the user can cancel by pressing
the ESC key.
>
> Is there a way to force the GridCellChoiceEditor to write it's updates
> to the table?
Yep, just do what would normally be done when the cell editor is
dismissed. Something like this IIRC:
if thegrid.IsCellEditControlShown():
thegrid.SaveEditControlValue()
thegrid.HideCellEditControl()
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list