On Sat, 4 Dec 2021 06:47:00 +0100 Vojtěch Bubník wrote:
VB> I am starting to think that the issue we are having has something to do
VB> with wxProgressDialog not playing well with the modal loop of a modal
VB> dialog.
wxProgressDialog uses wxYield() internally, so it can often result in
weird problems. My recommendation would be to avoid using it at all if
possible, especially because it doesn't have a great UI neither and it's
usually better to show the progress in some wxGauge inside the main window
rather than in a separate dialog.
VB> We see focus issues when we open a file open dialog, then on
VB> closing the file open dialog we start loading while showing the progress
VB> with wxProgressDialog. I will have to dig deeper.
This is a complete shot in the dark, but you might want to use CallAfter()
to postpone showing wxProgressDialog itself, perhaps the problem --
whatever it is, as I still don't really know what is is exactly -- is due
to creating wxProgressDialog while the previous dialog still exists.
VB> I don't think we break the default Activate event handler. I see that the
VB> default Activate handler calls SetFocus() on the widget that had the focus
VB> before the file open dialog opened, but the window and the widget is
VB> disabled, thus SetFocus() fails.
VB> Bind(wxEVT_ACTIVATE, [this](wxActivateEvent& event) {
VB> // something non-focus modifying
VB> event.Skip();
VB> });
Yes, this indeed shouldn't break anything.
Good luck,