- wxGenericGrid *grid = this;
- wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn());
- if (cell && grid->CurrentCellVisible())
- {
- cell->SetTextValue(grid->GetTextItem()->GetValue());
- wxClientDC dc(grid);
-
- dc.BeginDrawing();
- grid->SetGridClippingRegion(& dc);
- grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
- grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
- grid->HighlightCell(& dc);
- dc.DestroyClippingRegion();
- dc.EndDrawing();
-
- //grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
- wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
- grid->GetCursorRow(), grid->GetCursorColumn());
- GetEventHandler()->ProcessEvent(g_evt);
+ // michael - added this conditional to prevent change to
+ // grid cell text when edit control is hidden but still has
+ // focus
+ //
+ if ( m_editable )
+ {
+ wxGenericGrid *grid = this;
+ wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn());
+ if (cell && grid->CurrentCellVisible())
+ {
+ cell->SetTextValue(grid->GetTextItem()->GetValue());
+ if ( m_editInPlace && !m_inOnTextInPlace )
+ {
+ m_inPlaceTextItem->SetValue( grid->GetTextItem()->GetValue() );
+ }
+
+ wxClientDC dc(grid);
+
+ dc.BeginDrawing();
+ grid->SetGridClippingRegion(& dc);
+ grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
+ grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
+ if ( !(m_editable && m_editInPlace ) ) grid->HighlightCell(& dc);
+ dc.DestroyClippingRegion();
+ dc.EndDrawing();
+
+ //grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
+ wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
+ grid->GetCursorRow(), grid->GetCursorColumn());
+ GetEventHandler()->ProcessEvent(g_evt);
+
+ // grid->DrawCellText();
+ }
+ }
+}