I just updated to Juce 1.16 from 1.13 and the “choose folder” functionality isn’t working so well now. A couple of issues with FilenameComponent :
-
I’m using a FilenameComponent to display and choose a directory. The initial directory used to be loaded when I clicked the button but now it always goes to the desktop. I think it’s a unicode issue in the BFFM_INITIALIZED section of the browser callback – maybe using a PIDL instead of a string would be a better move here?
-
Once I’ve selected a folder and it’s displayed in the combo box, if I use the button or combo box to choose a new folder, the combo box displays the “nothing selected” text. Tracing through it, I can see that the “set” code is being called twice – the first time it’s good but the second time it wipes out the info.
Does anyone else see this behavior or maybe I’ve set things up incorrectly somehow?
I also have a couple of suggested cosmetic changes for the FilenameComponent class, to indicate when one is using it for a directory:
[code]void FilenameComponent::lookAndFeelChanged()
{
deleteAndZero (browseButton);
addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft);
// start my new stuff
if (isDir)
browseButton->setTooltip(T(“Click to browse for a different folder”));
// end my new stuff
resized();
browseButton->addButtonListener (this);
}
void FilenameComponent::buttonClicked (Button* button)
{
// start my new stuff
FileChooser fc (TRANS(isDir ? “Choose a new folder” : “Choose a new file”),
// end my new stuff
getCurrentFile(),
wildcard);
if (isDir ? fc.browseForDirectory()
: (isSaving ? fc.browseForFileToSave()
: fc.browseForFileToOpen()))
{
setCurrentFile (fc.getResult(), true);
}
}
[/code]
Thanks for all your hard work, Jules.