Incompatibility of GetColPos/GetRowPos and GetSelectionBlockTopLeft/GetSelectionBlockBottomRight functions in wxGrid
alexkd11 opened this issue · comments
Operating system: Windows 8.1
wxPython version & source: wxPython 4.2.0
Python version & source: Python 3.9
Description of the problem: The implemented selection of a block of table cells, which can then be obtained using GetSelectionBlockTopLeft/GetSelectionBlockBottomRight functions, works correctly only with Disables column moving by dragging or functions GetColPos/GetRowPos.
After changing the position of a column (position is not equal to the column ID), the selection process continues to use its ID (instead of position) and selects it even when it is out of range.
I think it is required to use the column/row position number instead of its ID number.
I’m thinking about how to intercept the process of highlighting with color and taking into account coordinates.
However, when selected from the keyboard, some events are missing (EVT_GRID_RANGE_SELECTING).
Code Example (click to expand)
class MyGrid(grid.Grid):
def __init__(self, parent):
super().__init__(parent)
self.EnableDragColMove()
def GetSelectionBox(self):
tl, br = self.GetSelectionBlockTopLeft(), self.GetSelectionBlockBottomRight()
This is probably wxWidgets, not wxPython.
Can you check this with wxWidgets directly? I could so, but only next week.
I'm not a fan of the reordered table display in wx. Myself, I'm catching the move event and re-ordering on the data side...
Yes. This is probably wxWidgets.
Two selection angles are specified - top left and bottom right. The selection includes all cells with column numbers between the corners (instead of position numbers).
The option with data transfer looks more complicated - the data is of different types with column metadata (properties), header, column width and other design. Essentially you are implementing your own column position functions.
As I understand it, I need to achieve the correct selection of the table area (keyboard and mouse). Next, I will make a selection of positions between two corners myself.
I see the issue in the wxWidgets grid sample.
Please report issues like this and #2525 in the wxWidgets issue tracker. There's no point in doing this here. wxPython will not implement a workaround.