File open/save sample code needs to be updated


#1

I’m not sure where to stick suggestions like this, so if this is the wrong place, please disabuse me.

The FileChooserDialogBox header has a nice snippet of sample code to illustrate how to create a FileChooserDialog box:

      WildcardFileFilter wildcardFilter ("*.foo", "Foo files");

        FileBrowserComponent browser (FileBrowserComponent::loadFileMode,
                                      File::nonexistent,
                                      &wildcardFilter,
                                      0);

        FileChooserDialogBox dialogBox ("Open some kind of file",
                                        "Please choose some kind of file that you want to open...",
                                        browser,
                                        getLookAndFeel().alertWindowBackground);

This little example just needs to be updated a bit:

1)WildCardFileFilter now takes three parameters, not two
2)FileBrowserComponent no longer has a “loadFileMode”, it’s been replaced with open, canSelectFiles, etc.
3)FileChooserDialogBox now takes 5 parameters, not 4
4)LookAndFeel no longer has an alertWindowBackground() method. I’m really not sure what the replacement is. I used Colours::grey, but perhaps there’s a better, more platform correct choice.

Other than that, the snippet was quite helpful!


#2

Oops! Yes, I think that comment might just be a little bit out of date! Thanks, I’ll tidy it up!