Ok, I´m using the component to display modules and presets. So far so good. The problem is the setSelectedFile , which doesn´t always work, and I´m wondering if it will work to display a preset/module name under several sub-directories, and if it won´t slow things down too much.
So far, I tested with:
void WusikTreeView::showPresetsFolder()
{
while (directoryList->isStillLoading()) { ; }
directoryList->setDirectory(File(audioProcessor->dataFiles->dataFilesString + PRESET_FOLDER), true, true);
treeView->refresh();
treeView->getRootItem()->setOpen(true);
while (directoryList->isStillLoading()) { ; }
treeView->setSelectedFile(File(presetFile));
}
If I call twice showPresetsFolder() it selects the correct file. But, if its in a subfolder, it will open the tree subfolder but won´t select it.
So, I´m wondering on making things differently. So far I added:
[code] String presetFile = String(audioProcessor->dataFiles->dataFilesString + PRESET_FOLDER + slash + audioProcessor->currentPresetName + PRESET_FILEEXT).toLowerCase();
for (int f = 0; f < treeView->getNumRowsInTree(); f++)
{
if (treeView->getItemOnRow(f)->getUniqueName().toLowerCase() == presetFile)
{
treeView->getItemOnRow(f)->setSelected(true, true);
break;
}
}[/code]
The problem is that the setSelected is not working. And this code only works for the main folder, not sub-folders, but I can improve the code to work with that. (I hope)
Any ideas on this?
Thanks!
Best Regards, WilliamK