Added Paul Gamman's patch for 0 as FALSE in bool editor and renderer.
Fixed bug in grid selection code that caused crashes (e.g. when grid had just 1 col and mode was row selection). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a98c006d8d
commit
695a326318
@ -1189,7 +1189,10 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
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();
|
||||
}
|
||||
@ -1795,7 +1798,10 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
|
||||
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 )
|
||||
{
|
||||
|
@ -402,7 +402,11 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
|
||||
}
|
||||
|
||||
// Handle single cell selection in SelectCell.
|
||||
if ( topRow == bottomRow && leftCol == rightCol )
|
||||
// (MB: added check for selection mode here to prevent
|
||||
// crashes if, for example, we are select rows and the
|
||||
// grid only has 1 col)
|
||||
if ( m_selectionMode == wxGrid::wxGridSelectCells &&
|
||||
topRow == bottomRow && leftCol == rightCol )
|
||||
SelectCell( topRow, leftCol, ControlDown, ShiftDown,
|
||||
AltDown, MetaDown, sendEvent );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user