You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When binding an EVT_PG_CHANGED from a PropertyGridManager the event only gets handled when using PropertyGridManager.Bind()
but not with Bind(..., MyPropertyGridManager).
The EVT_PG_CHANGED is an instance of wx.CommandEvent, so it should work with both ways.
Windows 11 Pro wx.version(): 4.2.1 msw (phoenix) wxWidgets 3.2.2.1, installed with pip install wxpython Python 3.12.4, stock
This issue also occurs using wxPython 4.2.1 gtk3 (phoenix) wxWidgets 3.2.4 + Python 3.12.3 + Linux Mint 22.
I have noticed that in the case where the EVT_PG_CHANGED event handler does get called in your example, _event.ShouldPropagate() returns False.
That is different to some other event types derived from wx.CommandEvent. For example, when EVT_BUTTON and EVT_TEXT_ENTER are bound in an equivalent manner, their event object's ShouldPropagate() method returns True.
If you derive a new class from PropertyGridPage and override its IsHandlingAllEvents() method to return False:
class MyPropertyGridPage(pg.PropertyGridPage):
def IsHandlingAllEvents(self):
return False
and use it in your example instead of pg.PropertyGridPage() then the self.Bind(pg.EVT_PG_CHANGED, self._on_event, self.m_pg) binding does work.
I think because the base class PropertyGridPage.IsHandlingAllEvents() method returns True, the C++ code calls event.StopPropagation() to stop the event propagating to the parent.
When binding an EVT_PG_CHANGED from a PropertyGridManager the event only gets handled when using
PropertyGridManager.Bind()
but not with
Bind(..., MyPropertyGridManager)
.The EVT_PG_CHANGED is an instance of wx.CommandEvent, so it should work with both ways.
Windows 11 Pro
wx.version(): 4.2.1 msw (phoenix) wxWidgets 3.2.2.1, installed with pip install wxpython
Python 3.12.4, stock
Description of the problem:
Code Example (click to expand)
The text was updated successfully, but these errors were encountered: