i have a wxGrid cell with a wxGridCellNumberEditor and have a special case where i do not only have an int in that cell of the grid, but i want to show i.e. "45±" instead of just "45".
now, it is no problem to remove the "±" before the editor is shown with wxEVT_GRID_EDITOR_SHOWN event, but the other way round crashes in the handler of the wxEVT_GRID_EDITOR_HIDDEN event. the simple
Code: Select all
SetCellValue(2, 2, "45±")
Code: Select all
void wxGrid::SetCellValue( int row, int col, const wxString& s )
{
if ( s == GetCellValue(row, col) )
{
// Avoid flicker by not doing anything in this case.
return;
}
if ( m_table )
{
m_table->SetValue( row, col, s );
if ( ShouldRefresh() )
{
int dummy;
wxRect rect( CellToRect( row, col ) );
rect.x = 0;
rect.width = m_gridWin->GetClientSize().GetWidth();
CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
m_gridWin->Refresh( false, &rect );
}
// HERE
if ( m_currentCellCoords.GetRow() == row &&
m_currentCellCoords.GetCol() == col &&
IsCellEditControlShown())
// Note: If we are using IsCellEditControlEnabled,
// this interacts badly with calling SetCellValue from
// an EVT_GRID_CELL_CHANGE handler.
{
HideCellEditControl();
ShowCellEditControl(); // will reread data from table
}
}
}
can I do anything about it?