If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
My program is executing an .exe file. During this the program shows the message "Taskbar icons are installed". If the task takes too long (because of user interference --> I use an autohotkey macro which uses keyboard and mouse input) there should first be the message "The process is taking too long, closing in 10 seconds), so the first wxBusyInfo should go away. And after 10 seconds there is a wxMessageBox where the wxBusyInfo should also go away as to now overlay the wxMessageBox. Is there a way to stop one wxBusyInfo message and show another one? I tried a deconstructor but it's only getting worse... In the code below I removed the deconstructor.
I would use a wxProgressDialog instead of wxBusyInfo. It gives you a chance to change the message and if you call Pulse() you also get an animation indicating that something is happening.
But if I wanted to use wxBusyInfo, would there be a way to stop this window inside such a loop? I mean, there is a deconstructor. Can't I call it from inside the loop?
But if I wanted to use wxBusyInfo, would there be a way to stop this window inside such a loop? I mean, there is a deconstructor. Can't I call it from inside the loop?
Create it on the heap (= with new()) and call "Destroy()" when you want to.
Okay, I tried something. The first wxBusyInfo disappears when going into the if-clause. But the second one (before the wxMessageBox) is never destroyed even though I do so in the third if-clause. And I have another question: How can I declare the wxBusyInfo without showing them? Because I want to declare it at the beginning so that I can destroy it from every if-clause without having to declare it inside the if-clause which makes things more difficult.
Here's what i would do:
- put that whole code in a function that returns a success/error code.
- this function will not display any wxmessagebox, the calling code will based on the return value
- create one wxBusyInfo on the stack like in the beginning
- change wxBusyInfo text if necessary
- when the function exits, wxBusyInfo will be destroyed automatically
Hm okay, maybe I'll try to rearrange this entire code. But I'm trying to understand why the second deconstructor for wait2 doesn't work in my code. I mean, the code works as expected except that the deconstructor for wait2 doesn't work.
Wanderer82 wrote: ↑Sun Jul 03, 2022 4:57 pm
Hm okay, maybe I'll try to rearrange this entire code. But I'm trying to understand why the second deconstructor for wait2 doesn't work in my code. I mean, the code works as expected except that the deconstructor for wait2 doesn't work.
Maybe you have to call ::wxYield() to make it disappear.
Hm okay. In the meantime I have rearraged my code. I didn't put it into a function but I took the while-loop out of the first if-loop and after the first 15 seconds have gone past I work with if-loops outside the while looop. Now everything is working as I want it to. Although the code is a bit blown up as I always check for the existence of at least one out of three files in a directory.