[wxPython-users] callback on wx.GridCellChoiseEditor

Robin Dunn robin at alldunn.com
Mon Jul 2 08:50:27 PDT 2007


Bruno Normand wrote:
> Hi,
> I use wx.grid.Grid with wxPython, in cell I have a wx.GridCellChoiseEditor.
> I want to be able to control the selection made by the user, as I did 
> not find a callback being able to be associated the selection in the 
> combobox, I used the callback associated the change of the value in the 
> cell (wx.grid.EVT_GRID_CELL_CHANGE), which is active at the exit of the 
> cell and not when the user selected a value in the combobox posted by 
> GridCellChoiseEditor.
> That goes as much as the seized value is valid and that I do not need 
> not modified; but if the value is invalid, I want to give the old value 
> and there begins the problem, the callback is automatically called as 
> soon as I carry out SetCellValue on the cell and as the posted value is 
> not that passed to SetCellValue but the value posted by the selection in 
> the combobox, I detect that the answer is invalid and impossible to 
> leave there.
> 
> Would somebody have a solution to associate a callback during the 
> seizure in the combobox posted by wx.GridCellChoiseEditor ?

You can get access to the actual control used by the editor in the 
EVT_GRID_EDITOR_CREATED event.  In the handler just call 
event.GetControl() and then you can bind your own event handlers to it.


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





More information about the wxpython-users mailing list