FileChooser not showing up on windows

gui

#1

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


#2

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


#3

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?


#4

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 ^^


#5

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


#6

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


#7

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


#8

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.


#9

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