FileChooser not showing up on windows

Hi Juce people,

I’ve got a very strange and frustrating bug to do the FileChooser class on windows. I created a GUI Application through the projucer, which has a button on it which is used to open the windows file chooser using the following code:

void FolderChooserArea::buttonClicked(juce::Button *buttonThatWasClicked)
{
DBG(“button was clicked”);

FileChooser myChooser ("Please select a folder to analyse",
                       File::getSpecialLocation (File::userHomeDirectory),
                       "*");
if (myChooser.browseForDirectory())
{
    File folder (myChooser.getResult());
    String folderPath = folder.getFullPathName();
    setFolderPath(folderPath);
}

}

the first time I click the button on my UI to open the file chooser everything works as expected. If I click OK on the windows file chooser the window closes, as expected. However, if I click the button on my UI to open the file chooser again the file chooser does not appear and the app appears to freeze. There is a brief moment just after I click the button on my UI for the second time where some kind of popup seems to appear just before everything freezes.

I have tried frantically to debug this but haven’t managed to solve the problem. If anyone has any thoughts that might help I’d be very grateful to hear them!

Thanks,

Toby

I can’t reproduce this on Windows 10. What version of Windows are you using? Can you reproduce it with a simple test app?

You say you’ve tried to debug it, but surely it’s very easy to see in the debugger exactly what the stack trace is when it’s stuck, which should show you exactly what’s going on?

I’m on windows 10 Pro. I actually tried the test app for playing sounds and it is working absoluetly fine, which is great because it means that I can eventually get my app working as well, probably ^^

The problem is the stack looks fine! It looks like the windows file chooser is being created but for some reason isn’t visible.

It’s not just stuck behind your window, is it?

it might be, I’m a bit of noob at this stuff, can I send it to the front somehow?

Well, you shouldn’t need to. But you should work out what’s going on, I think. If Ed couldn’t reproduce this then there’s not much we can do to debug it for you.

yeah I thought so, it was just a last ditch attempt to see if anyone had had this kind of problem before. Thanks anyway!