A question for one of you c++ experts here. I am modifying some existing windows code so I can run in on android. But I am changing to use a FileChooser as done in DialogsDemo.h and I don’t understand the code. Here is the snippet:
fc.reset (new FileChooser (“Choose a file to open…”, File::getCurrentWorkingDirectory(),
“*”, useNativeVersion));
fc->launchAsync (FileBrowserComponent::canSelectMultipleItems | FileBrowserComponent::openMode
| FileBrowserComponent::canSelectFiles,
[] (const FileChooser& chooser)
{
String chosen;
auto results = chooser.getURLResults();
for (auto result : results)
chosen << (result.isLocalFile() ? result.getLocalFile().getFullPathName()
: result.toString (false)) << "\n";
AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon,
"File Chooser...",
"You picked: " + chosen);
});
This compiles.
But calling a function instead of the alert window such as:
MyFunction(chosen);
This gives an error about local variables in a lambda body.cannot be referenced unless int he capture list. How resolve I do this???

