[wxPython-users] wx.GridCellChoiceEditor

Mark Erbaugh mark at microenh.com
Mon Feb 4 11:22:20 PST 2008


On Mon, 2008-02-04 at 10:50 -0800, Robin Dunn wrote:
> 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,

Thanks. That works like a champ.

Mark





More information about the wxpython-users mailing list