I’m working on a widget that I want to work as a drop-in replacement for something like ListCtrl or UltimateListCtrl. It uses the WebView widget and some HTML and CSS, and communicates through changing the “webpage title” and using the RunScript call. I’m catching click events in javascript and sending the row index back to Python (I will probably change this to add the column index also).
The problem right now is, rather than just returning the indices, how can I set them as event data, then emit an event (like wx.EVT_LIST_ITEM_ACTIVATED or wx.EVT_LIST_ITEM_SELECTED) such that my existing event handling code doesn’t need re-written?
Attached is sample code that seems to only work with wxPython 3.0
P.S. the last time I posted this code, a few minutes ago, the click and double click events weren’t firing, but I found it was because I needed to re-bind the tablerow (tr) click event after adding new rows. I fixed it for now (though I can probably make it more efficient later).
jquery-1.11.0.js (276 KB)
WebList.html (2.54 KB)
WebList.py (5.18 KB)
Maybe PostEvent is what I want? But how do I ensure the resulting event object will have the right object for event.GetEventObject()??? How would I attach the row and column index to the event, or I guess I would attach them to the object that GetEventObject returns.
···
On Wednesday, June 4, 2014 4:47:41 PM UTC-7, Nathan McCorkle wrote:
I’m working on a widget that I want to work as a drop-in replacement for something like ListCtrl or UltimateListCtrl. It uses the WebView widget and some HTML and CSS, and communicates through changing the “webpage title” and using the RunScript call. I’m catching click events in javascript and sending the row index back to Python (I will probably change this to add the column index also).
The problem right now is, rather than just returning the indices, how can I set them as event data, then emit an event (like wx.EVT_LIST_ITEM_ACTIVATED or wx.EVT_LIST_ITEM_SELECTED) such that my existing event handling code doesn’t need re-written?
Attached is sample code that seems to only work with wxPython 3.0
P.S. the last time I posted this code, a few minutes ago, the click and double click events weren’t firing, but I found it was because I needed to re-bind the tablerow (tr) click event after adding new rows. I fixed it for now (though I can probably make it more efficient later).
Just found and started reading this:
http://wiki.wxpython.org/CreatingCustomControls
···
On Wednesday, June 4, 2014 4:49:44 PM UTC-7, Nathan McCorkle wrote:
Maybe PostEvent is what I want? But how do I ensure the resulting event object will have the right object for event.GetEventObject()??? How would I attach the row and column index to the event, or I guess I would attach them to the object that GetEventObject returns.
On Wednesday, June 4, 2014 4:47:41 PM UTC-7, Nathan McCorkle wrote:
I’m working on a widget that I want to work as a drop-in replacement for something like ListCtrl or UltimateListCtrl. It uses the WebView widget and some HTML and CSS, and communicates through changing the “webpage title” and using the RunScript call. I’m catching click events in javascript and sending the row index back to Python (I will probably change this to add the column index also).
The problem right now is, rather than just returning the indices, how can I set them as event data, then emit an event (like wx.EVT_LIST_ITEM_ACTIVATED or wx.EVT_LIST_ITEM_SELECTED) such that my existing event handling code doesn’t need re-written?
Attached is sample code that seems to only work with wxPython 3.0
P.S. the last time I posted this code, a few minutes ago, the click and double click events weren’t firing, but I found it was because I needed to re-bind the tablerow (tr) click event after adding new rows. I fixed it for now (though I can probably make it more efficient later).