I am receiving messages from the network on a non-GUI thread and need to use wxEvtHandler::AddPendingEvent to tell the GUI to update accordingly. I also need to pass data to my GUI code so that it can act apropriately.
I believe I have to create a custom ev开发者_开发百科ent, but haven't found a straightforward implementation. This closest thing that I've found is The wxWiki on Creating a Custom Event, which is a partial example.
If you are receiving messages from a different thread, then you explicitily can not use AddPendingEvent. You must instead use wxEvtHandler::QueueEvent.
Second, there are a couple of good examples for creating custom event classes: the old way, the new way.
With the old way, you can also use the Connect method and leave off the event table, but it's not illustrated in that example. The new way has the much preferred Bind method... but as you can see in my question, I'm having my own problems with it.
精彩评论