Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility of GetColPos/GetRowPos and GetSelectionBlockTopLeft/GetSelectionBlockBottomRight functions in wxGrid #2524

Open
alexkd11 opened this issue Feb 8, 2024 · 3 comments

Comments

@alexkd11
Copy link

alexkd11 commented Feb 8, 2024

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()
@DietmarSchwertberger
Copy link
Contributor

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...

@alexkd11
Copy link
Author

alexkd11 commented Feb 9, 2024

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.

@DietmarSchwertberger
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants