Underlying C++ error while expanding grid column

Any chance anyone has seen this error and knows the cause?

SystemError: <class ‘wx._core.IdleEvent’> returned a result with an error set
wx._core.wxAssertionError: C++ assertion ““col >= 0 && col < m_numCols”” failed at …\src\generic\grid.cpp(9846) in wxGrid::DoSetColSize(): invalid column index

The above exception was the direct cause of the following exception:

SystemError: <class ‘wx._core.IdleEvent’> returned a result with an error set
wx._core.wxAssertionError: C++ assertion ““col >= 0 && col < m_numCols”” failed at …\src\generic\grid.cpp(9846) in wxGrid::DoSetColSize(): invalid column index

What were you doing when that happened?

From the looks it of it, it looks like you were trying to resize a column,
but you supplied an invalid column index. Or based on the fact that this
happened in an IdleEvent, was wxWidgets doing this itself?

What I discovered is this error only occurs if I use the header (top cell or area) and attempt to resize the column. But if I use the area below the header to resize the column all works - without an error reported. I’m guessing but it appears that some event is not happening with col resize event when I attempt to do it on the header.
Johnf

Do you have a simple complete example that reproduces the problem? If so,
please send it or file an issue on GitHub.

Scott

Thanks for your help. I really can’t provide a clean example of the code because the issue is happening in code that adds special features (Dabo) to a grid. But I am getting closer to solving the issue.
Johnf

If you post a runnable sample (without Dabo), I will step through with the debugger.

1 Like

I only see the issue with the Dabo version. So posting something doesn’t make any sense. The funny thing is the Dabo grid.py test program does the same thing. That, I feel, tells me that it is in the Dabo code and not my code that uses Dabo.
Johnf

Could be this issue:

Looks like it will be fixed in wxWidgets 3.1.6. The 4.1.2 alpha that I’m running uses wxWidgets 3.1.5, and so still has the problem.

A workaround is to add event.Skip() to any wx.grid.EVT_GRID_CELL_LEFT_CLICK event handlers.

Interesting - it might be the issue. But of course the problem only happens on the header and not on expanding a cell.
Johnf