Handle clicks on grid edges normally when not using drag-resizing
Clicking on (or near) the grid column or row edges was handled specially to allow dragging them in order to resize the column or row, but this doesn't need to be done if drag-resizing the columns or rows is not allowed in the first place and resulted in surprising user-visible behaviour: e.g. when using row selection, clicking mostly anywhere in the row selected it, except if the click happened to be between the two columns, in which case it didn't. Fix this and always select the row in such scenario now. Unfortunately, doing this required adding yet more CanDragXXX() functions in addition to the already impressive panoply of them in wxGrid, but we need CanDragGridColEdges() as none of the existing functions checked for m_useNativeHeader (there was instead an ad hoc check for it directly in the mouse handling code) and the row version had to be added for symmetry.
This commit is contained in:
@@ -1675,7 +1675,27 @@ public:
|
||||
void DisableRowResize(int row) { DoDisableLineResize(row, m_setFixedRows); }
|
||||
void DisableColResize(int col) { DoDisableLineResize(col, m_setFixedCols); }
|
||||
|
||||
// these functions return whether the given row/column can be
|
||||
// These function return true if resizing rows/columns by dragging
|
||||
// their edges inside the grid is enabled. Note that this doesn't cover
|
||||
// dragging their separators in the label windows (which can be enabled
|
||||
// for the columns even if dragging inside the grid is not), nor checks
|
||||
// whether a particular row/column is resizeable or not, so you should
|
||||
// always check CanDrag{Row,Col}Size() below too.
|
||||
bool CanDragGridRowEdges() const
|
||||
{
|
||||
return m_canDragGridSize && m_canDragRowSize;
|
||||
}
|
||||
|
||||
bool CanDragGridColEdges() const
|
||||
{
|
||||
// When using the native header window we can only resize the columns by
|
||||
// dragging the dividers in the header itself, but not by dragging them
|
||||
// in the grid because we can't make the native control enter into the
|
||||
// column resizing mode programmatically.
|
||||
return m_canDragGridSize && m_canDragColSize && !m_useNativeHeader;
|
||||
}
|
||||
|
||||
// These functions return whether the given row/column can be
|
||||
// effectively resized: for this interactive resizing must be enabled
|
||||
// and this index must not have been passed to DisableRow/ColResize()
|
||||
bool CanDragRowSize(int row) const
|
||||
|
Reference in New Issue
Block a user