I’m still having some issues with dynamically updating my UI (widgets) when updating my database (MySQL). I thought I had this solved by using show, update and events on various widgets at different points in my code but then I stumbled across app.processEvents().
This function appeared to solve all my previous problems and allowed me update widgets from anywhere in my code. Then I read that using this is a bad practice due to possible unplanned events firing when I don’t need them to and also using it slows down the code…
OK … so I did some additional digging and came across Martin’s short Threading Walk Through showing a better way of handling data updates in a different thread. I’ve modified my code utilize this and have run into a new set of problems.
The bottom portion of my screen layouts I have a section reserved for buttons, prompts and messages as my application runs. This area continually updates via a messagebox() (my code). I need the thread to use this function when it completes.
What’s happening currently is the thread does complete as expected but the call to messagebox() is outputting to it’s own thread. I need it output to the main thread.
Any ideas ? I can show the worker definition and messagebox() but my app currently is huge.
After some additional googling and some further testing I don’t see any real need to involve a separate thread with my application. From a speed aspect I don’t see anything worth the trouble of trying to implement this within my existing code so I’m abandoning trying to implement a separate thread. The few times I use app.processEvents() I don’t see any great risks in doing this.
Thank you very much for this input. Very much appreciated.
The one thing I’ve come accustomed to with Application Development is there’s always more than one way to skin a cat (not literally … but I am more a dog person) and just when you think you have the answer to resolve your latest issue someone points you in another direction and this now becomes the better way of handling it !