This is a patch against version 1.222 of
src/generic/grid.cpp.
1. The patch contains a fix for the row selection as
mentioned by me on the wx-dev mailing list. After
selecting one row and deselecting it no new row
could be selected.
2. Another change has been made to the function
CoordToRowOrCol() and addresses an error mailed
to wx-dev by John Labensky. The error was that no
cell could be selected until a horizontal and vertical
resize of at least one cell has been made. The error
was that the function could not handle grids with
default row or columns sizes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17112
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Internal helper macros for simpler use of that function
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
// Internal helper macros for simpler use of that function
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
- const wxArrayInt& BorderArray, bool maxOnOverflow);
+ const wxArrayInt& BorderArray, int nMax,
+ bool maxOnOverflow);
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
WXGRID_MIN_COL_WIDTH, \
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
WXGRID_MIN_COL_WIDTH, \
+ m_colRights, m_numCols, TRUE)
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
WXGRID_MIN_ROW_HEIGHT, \
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
WXGRID_MIN_ROW_HEIGHT, \
+ m_rowBottoms, m_numRows, TRUE)
/////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
/////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
{
if ( !event.ShiftDown() && !event.ControlDown() )
ClearSelection();
{
if ( !event.ShiftDown() && !event.ControlDown() )
ClearSelection();
- else if ( m_selection )
{
if ( event.ShiftDown() )
{
{
if ( event.ShiftDown() )
{
// of m_rowBottoms/m_ColRights to speed up the search!
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
// of m_rowBottoms/m_ColRights to speed up the search!
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
- const wxArrayInt& BorderArray, bool maxOnOverflow)
+ const wxArrayInt& BorderArray, int nMax,
+ bool maxOnOverflow)
{
if (!defaultDist)
defaultDist = 1;
{
if (!defaultDist)
defaultDist = 1;
i_min = 0;
if (BorderArray.IsEmpty())
{
i_min = 0;
if (BorderArray.IsEmpty())
{
+ if((int) i_max <= nMax)
+ return i_max;
return maxOnOverflow ? (int)i_max : -1;
}
return maxOnOverflow ? (int)i_max : -1;
}
int wxGrid::YToRow( int y )
{
return CoordToRowOrCol(y, m_defaultRowHeight,
int wxGrid::YToRow( int y )
{
return CoordToRowOrCol(y, m_defaultRowHeight,
- WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, FALSE);
+ WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, m_numRows, FALSE);
}
int wxGrid::XToCol( int x )
{
return CoordToRowOrCol(x, m_defaultColWidth,
}
int wxGrid::XToCol( int x )
{
return CoordToRowOrCol(x, m_defaultColWidth,
- WXGRID_MIN_COL_WIDTH, m_colRights, FALSE);
+ WXGRID_MIN_COL_WIDTH, m_colRights, m_numCols, FALSE);