Don't use row/column headers for selection incompatible with mode
Mouse events in row/column headers should be just ignored when the current selection mode disallows row/column selection. This wasn't the case before, and while actually selecting the line corresponding to the header was disallowed further down the call chain, clicking it still unexpectedly cleared the existing selection and dragging mouse in the header window selected the entire grid. Fix this by just never entering the corresponding cursor mode in the first place if it's incompatible with the current selection mode.
This commit is contained in:
parent
4cabffb983
commit
4f7ed07f5e
@ -3720,7 +3720,11 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo
|
|||||||
if ( row >= 0 &&
|
if ( row >= 0 &&
|
||||||
!SendEvent( wxEVT_GRID_LABEL_LEFT_CLICK, row, -1, event ) )
|
!SendEvent( wxEVT_GRID_LABEL_LEFT_CLICK, row, -1, event ) )
|
||||||
{
|
{
|
||||||
if ( m_selection && m_numRows > 0 && m_numCols > 0 )
|
// Check if row selection is possible and allowed, before doing
|
||||||
|
// anything else, including changing the cursor mode to "select
|
||||||
|
// row".
|
||||||
|
if ( m_selection && m_numRows > 0 && m_numCols > 0 &&
|
||||||
|
m_selection->GetSelectionMode() != wxGridSelectColumns )
|
||||||
{
|
{
|
||||||
bool selectNewRow = false;
|
bool selectNewRow = false;
|
||||||
|
|
||||||
@ -3756,12 +3760,12 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo
|
|||||||
|
|
||||||
SetCurrentCell(row, GetFirstFullyVisibleColumn());
|
SetCurrentCell(row, GetFirstFullyVisibleColumn());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ChangeCursorMode(WXGRID_CURSOR_SELECT_ROW, rowLabelWin);
|
ChangeCursorMode(WXGRID_CURSOR_SELECT_ROW, rowLabelWin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------ Left double click
|
// ------------ Left double click
|
||||||
//
|
//
|
||||||
@ -4118,7 +4122,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_selection && m_numRows > 0 && m_numCols > 0 )
|
if ( m_selection && m_numRows > 0 && m_numCols > 0 &&
|
||||||
|
m_selection->GetSelectionMode() != wxGridSelectRows )
|
||||||
{
|
{
|
||||||
bool selectNewCol = false;
|
bool selectNewCol = false;
|
||||||
|
|
||||||
@ -4154,13 +4159,13 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo
|
|||||||
|
|
||||||
SetCurrentCell(GetFirstFullyVisibleRow(), col);
|
SetCurrentCell(GetFirstFullyVisibleRow(), col);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ChangeCursorMode(WXGRID_CURSOR_SELECT_COL, colLabelWin);
|
ChangeCursorMode(WXGRID_CURSOR_SELECT_COL, colLabelWin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ------------ Left double click
|
// ------------ Left double click
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user