Search code examples
multithreadingwxwidgets

How to change the current selection in a wxListbook from another thread?


How can I change the current selection in a wxListbook from another thread?

When I pass the listbook's pointer to the thread and try to change the selection, the app crashes. What is a safe way of doing this? Is there some message I can send to it?


Solution

  • Actually you should avoid accessing wxWidget objects outside the main thread. wxWidgets isn't thread safe. What you can do is sending an event to the main thread. So you do your work in your own thread but do the updating of wxListbook inside the main thread.