- // is it possible to edit the current cell at all?
- if ( !IsCellEditControlEnabled() && CanEnableCellControl() )
- {
- // yes, now check whether the cells editor accepts the key
- int row = m_currentCellCoords.GetRow();
- int col = m_currentCellCoords.GetCol();
- wxGridCellAttr* attr = GetCellAttr(row, col);
- wxGridCellEditor *editor = attr->GetEditor(this, row, col);
-
- // <F2> is special and will always start editing, for
- // other keys - ask the editor itself
- if ( (event.GetKeyCode() == WXK_F2 && !event.HasModifiers())
- || editor->IsAcceptedKey(event) )
- {
- // ensure cell is visble
- MakeCellVisible(row, col);
- EnableCellEditControl();
-
- // a problem can arise if the cell is not completely
- // visible (even after calling MakeCellVisible the
- // control is not created and calling StartingKey will
- // crash the app
- if( editor->IsCreated() && m_cellEditCtrlEnabled ) editor->StartingKey(event);
- }
- else
- {
- event.Skip();
- }
-
- editor->DecRef();
- attr->DecRef();
- }
- else
- {
- // let others process char events with modifiers or all
- // char events for readonly cells
- event.Skip();
- }