createFileBrowserGoUpButton()?


#1

I’ve noticed that the look and feel of the fileBrowserGoUp button is created in the FIleBrowserDialogue constructor. Should its look and feel update if you call a setLookAndFeel() after creating the FileBrowserDialog? In my custom look and feel class I have overridden createFileBrowserGoUpButton() but it never gets called. It keeps calling the Juce one. Here’s what I do:

FileBrowserComponent browser (FileBrowserComponent::canSelectFiles|FileBrowserComponent::saveMode, File::nonexistent, &wildcardFilter, nullptr);
FileChooserDialogBox dialogBox (“Open some kind of file”, “Please choose…”, browser, false, Colours::black);
dialogBox.setLookAndFeel(basicLookAndFeel);
browser.setLookAndFeel(basicLookAndFeel);

Any thoughts?


#2

If possible, you could use the provided juce::LookAndFeel::setDefaultLookAndFeel method.


#3

That doesn’t help either. It still draws the native up arrow. :frowning:


#4

So I’ve hit this problem with another component now. I’m using a PropertyPanel. I have set my own look and feel, and have overridden the getDefaultScrollbarWidth() virtual function. But my propertypanel never calls it, which causes a sigrev when this function gets called:

int Viewport::getScrollBarThickness() const
{
return scrollBarThickness > 0 ? scrollBarThickness
: getLookAndFeel().getDefaultScrollbarWidth();
}

I’ve put breakpoints in my look and feel at getDefaultScrollbarWidth() and it never gets hit? I’m missing something?


#5

I have just run into the same thing. I cannot override the createFileBrowserGoUpButton method in LookAndFeel.

My suspicion is that this is happening because createFileBrowserGoUpButton is called in FileBrowserComponent’s constructor, before I have a chance to apply my custom LookAndFeel.

I am called setDefaultLookAndFeel() as in my AudioProcessorEditor’s constructor, but by then it is too late: FileBrowserComponent’s constructor has already run. Is there any way I can call setDefaultLookAndFeel earlier, or instantiate FileBrowserComponent later?

I also notice that I cannot change FileBrowserComponent’s “go up” arrow colour by overriding TextButton::textColourOffId, even when using sendLookAndFeelChange() after defining my custom colour.

I suspect this is because FileBrowserComponent’s lookAndFeelChanged() method does not update the colour of the goUpbutton.

@Rory, did you ever solve this one?


#6

I am happy to report that I was able to solve this one, thanks to a very instructive post by @lalala in this thread: Best place for custom look instantiation in a plugin?, which explains how to call setDefaultLookAndFeel before AudioProcessorEditor’s other members have instantiated.

I love these forums!


#7

Glad you got it sorted. Looks like I did too but it’s such a long time ago now I don’t recall how :wink: But yes, thank heaven for the forum. It’s saved many a developer!