wxGrid events in the constructor

46 views
Skip to first unread message

Сергей Коныгин

unread,
May 28, 2025, 6:54:13 AMMay 28
to wx-users
Hi!

I can't understand which wxGrid functions create events. For example, it seems to me that the wxGrid::SetCellValue function can generate the EVT_GRID_CELL_CHANGED event. At least, I had cases when for some reason the handler of this event was called from window class constructor. I even had to block the handler from running when it was called from the constructor. A similar situation occurs when I need to change other cells in the EVT_GRID_CELL_CHANGED event handler.  It happens that the error shown in the figure appears randomly.
How to properly change wxGrid content from constructor and event handlers?

1.png

Vadim Zeitlin

unread,
Jun 1, 2025, 6:32:53 AMJun 1
to wx-u...@googlegroups.com
On Wed, 28 May 2025 03:54:12 -0700 (PDT) Сергей Коныгин wrote:

> I can't understand which wxGrid functions create events.

I wouldn't expect any of them to do it.

> For example, it seems to me that the wxGrid::SetCellValue function can
> generate the EVT_GRID_CELL_CHANGED event.

I don't think it does. And if you run the grid sample, you won't see any
events for the calls to SetCellValue() in the main frame ctor.

> How to properly change wxGrid content from constructor and event handlers?

You would need to produce either a minimal standalone example or a minimal
patch to the grid sample reproducing the problem, as I just don't
understand what it is, so I can't help you with fixing it.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/

Vadim Zeitlin

unread,
Jul 9, 2025, 1:32:31 PMJul 9
to wx-u...@googlegroups.com
On Sun, 1 Jun 2025 12:32:45 +0200 I wrote:

Me> On Wed, 28 May 2025 03:54:12 -0700 (PDT) Сергей Коныгин wrote:
Me>
Me> > I can't understand which wxGrid functions create events.
Me>
Me> I wouldn't expect any of them to do it.
Me>
Me> > For example, it seems to me that the wxGrid::SetCellValue function can
Me> > generate the EVT_GRID_CELL_CHANGED event.
Me>
Me> I don't think it does.

I was wrong about this, it did start generating them since v3.2.3, but
this was unwanted and unexpected, IOW it was a bug and I've created
https://github.com/wxWidgets/wxWidgets/pull/25620 fixing it now.
Reply all
Reply to author
Forward
0 new messages