On Windows, native file choosers have the annoying property that they are not automatically focused when the user clicks on the main window while one is open. Also once the file chooser is behind another window, there’s no way to bring it back to focus and your app just appears to hang.
Normally if you show dialogs in Windows, you have to set up an owner
HWND, eg. for an open dialog that’s most likely your main window.
So let’s apply the following patch to
juce_win32_FileChooser.cpp. This grabs the current component with keyboard focus and assumes that’s the parent window for the file chooser. It’s a bit hacky but it gets the job done:
filechooser-5.diff.txt (3.4 KB)
The file choosers now behave as expected — if you click the main window, the file chooser will pop to the top and the title bar will flash. No more “hangs”.