bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
{
// accept the simple key presses, not anything with Ctrl/Alt/Meta
- return !event.HasModifiers();
+ return !(event.ControlDown() || event.AltDown());
}
void wxGridCellEditor::StartingKey(wxKeyEvent& event)
m_control = new wxTextCtrl(parent, id, wxEmptyString,
wxDefaultPosition, wxDefaultSize
#if defined(__WXMSW__)
- , wxTE_MULTILINE | wxTE_NO_VSCROLL | wxTE_AUTO_SCROLL
+ , wxTE_PROCESS_TAB | wxTE_MULTILINE |
+ wxTE_NO_VSCROLL | wxTE_AUTO_SCROLL
#endif
);
}
#else // !GTK
int extra_x = ( rect.x > 2 )? 2 : 1;
-
-// MB: treat MSW separately here otherwise the caret doesn't show
-// when the editor is in the first row.
+
+// MB: treat MSW separately here otherwise the caret doesn't show
+// when the editor is in the first row.
#if defined(__WXMSW__)
int extra_y = 2;
#else
if (grid->GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL))
m_startValue = grid->GetTable()->GetValueAsBool(row, col);
else
- m_startValue = !!grid->GetTable()->GetValue(row, col);
+ {
+ wxString cellval( grid->GetTable()->GetValue(row, col) );
+ m_startValue = !( !cellval || (cellval == "0") );
+ }
CBox()->SetValue(m_startValue);
CBox()->SetFocus();
}
event.Skip( m_grid->ProcessEvent( event ) );
break;
+ case WXK_NUMPAD_ENTER:
case WXK_RETURN:
if (!m_grid->ProcessEvent(event))
m_editor->HandleReturn(event);
case WXK_ESCAPE:
case WXK_TAB:
case WXK_RETURN:
+ case WXK_NUMPAD_ENTER:
break;
default:
if ( grid.GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL) )
value = grid.GetTable()->GetValueAsBool(row, col);
else
- value = !!grid.GetTable()->GetValue(row, col);
+ {
+ wxString cellval( grid.GetTable()->GetValue(row, col) );
+ value = !( !cellval || (cellval == "0") );
+ }
if ( value )
{
wxGridCellRenderer* wxGridTypeRegistry::GetRenderer(int index)
{
wxGridCellRenderer* renderer = m_typeinfo[index]->m_renderer;
- renderer->IncRef();
+ if (renderer)
+ renderer->IncRef();
return renderer;
}
wxGridCellEditor* wxGridTypeRegistry::GetEditor(int index)
{
wxGridCellEditor* editor = m_typeinfo[index]->m_editor;
- editor->IncRef();
+ if (editor)
+ editor->IncRef();
return editor;
}
wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider();
if (attrProvider) {
attrProvider->UpdateAttrRows( pos, -((int)numRows) );
-// ifdef'd out following patch from Paul Gammans
-#if 0
+// ifdef'd out following patch from Paul Gammans
+#if 0
// No need to touch column attributes, unless we
// removed _all_ rows, in this case, we remove
// all column attributes.
// needed data is not available inside UpdateAttrRows.
if ( !GetNumberRows() )
attrProvider->UpdateAttrCols( 0, -GetNumberCols() );
-#endif
+#endif
}
if ( !GetBatchCount() )
{
wxGridCellAttrProvider * attrProvider = m_table->GetAttrProvider();
if (attrProvider) {
attrProvider->UpdateAttrCols( pos, -((int)numCols) );
-// ifdef'd out following patch from Paul Gammans
-#if 0
+// ifdef'd out following patch from Paul Gammans
+#if 0
// No need to touch row attributes, unless we
// removed _all_ columns, in this case, we remove
// all row attributes.
// needed data is not available inside UpdateAttrCols.
if ( !GetNumberCols() )
attrProvider->UpdateAttrRows( 0, -GetNumberRows() );
-#endif
+#endif
}
if ( !GetBatchCount() )
{
break;
case WXK_RETURN:
+ case WXK_NUMPAD_ENTER:
if ( event.ControlDown() )
{
event.Skip(); // to let the edit control have the return
}
CalcCellsExposed( r );
-
+
// Otherwise refresh redraws the highlight!
m_currentCellCoords = coords;
case wxRIGHT: horiz = wxALIGN_RIGHT; break;
case wxCENTRE: horiz = wxALIGN_CENTRE; break;
}
-
+
switch ( vert )
{
case wxTOP: vert = wxALIGN_TOP; break;
case wxBOTTOM: vert = wxALIGN_BOTTOM; break;
case wxCENTRE: vert = wxALIGN_CENTRE; break;
}
-
+
if ( horiz == wxALIGN_LEFT || horiz == wxALIGN_CENTRE || horiz == wxALIGN_RIGHT )
{
m_rowLabelHorizAlign = horiz;
case wxRIGHT: horiz = wxALIGN_RIGHT; break;
case wxCENTRE: horiz = wxALIGN_CENTRE; break;
}
-
+
switch ( vert )
{
case wxTOP: vert = wxALIGN_TOP; break;
case wxBOTTOM: vert = wxALIGN_BOTTOM; break;
case wxCENTRE: vert = wxALIGN_CENTRE; break;
}
-
+
if ( horiz == wxALIGN_LEFT || horiz == wxALIGN_CENTRE || horiz == wxALIGN_RIGHT )
{
m_colLabelHorizAlign = horiz;
}
-void wxGrid::SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
+void wxGrid::SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
bool addToSelected )
{
if ( IsSelection() && !addToSelected )
ClearSelection();
- m_selection->SelectBlock( topRow, leftCol, bottomRow, rightCol,
- FALSE, addToSelected );
+ m_selection->SelectBlock( topRow, leftCol, bottomRow, rightCol,
+ FALSE, addToSelected );
}