开发者

How to capture events for each key press in wxPropertyGrid

开发者 https://www.devze.com 2023-03-27 05:51 出处:网络
In wxPython I\'m trying to update an existing UI to use wxPropertyGrid instead of an array of individual UI elements.Currently the underlying object model is updated and validation is applied after ea

In wxPython I'm trying to update an existing UI to use wxPropertyGrid instead of an array of individual UI elements. Currently the underlying object model is updated and validation is applied after each key press and I want to do the same with the PropertyGrid.

The problem I'm having is that there doesn't seem to exist a wxPropertyGridEvent which triggers on every key stroke like wx.EVT_TEXT, the closest is EVT_PG_CHANGED but that only triggers when you change between rows in the grid. I can get round this to an extent by binding wx.EVT_TEXT to the PropertyGrid but then I'm unable to use event.GetProperty() in order to access the property data as the event is not a PropertyGridEvent.

So the question is have I missed something and is there an existing event whi开发者_如何学Pythonch I can use? Failing that any ideas on how I get around this problem?


Turns out you can capture EVT_CHAR events by binding directly to the text ctrl. As the text ctrl is only created when the property is selected however you can't do this when setting up the grid, rather you have to bind it following a EVT_PG_SELECTED event.

0

精彩评论

暂无评论...
验证码 换一张
取 消