Browse Source

FileTreeComponent selection fix.

tags/2021-05-28
jules 13 years ago
parent
commit
d046e30b25
1 changed files with 25 additions and 10 deletions
  1. +25
    -10
      modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp

+ 25
- 10
modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp View File

@@ -116,28 +116,43 @@ public:
{
setOpen (true);
for (int i = 0; i < getNumSubItems(); ++i)
if (FileListTreeItem* f = dynamic_cast <FileListTreeItem*> (getSubItem (i)))
if (f->selectFile (target))
return true;
for (int maxRetries = 500; --maxRetries > 0;)
{
for (int i = 0; i < getNumSubItems(); ++i)
if (FileListTreeItem* f = dynamic_cast <FileListTreeItem*> (getSubItem (i)))
if (f->selectFile (target))
return true;
// if we've just opened and the contents are still loading, wait for it..
if (subContentsList != nullptr && subContentsList->isStillLoading())
{
Thread::sleep (10);
rebuildItemsFromContentList();
}
else
{
break;
}
}
}
return false;
}
void changeListenerCallback (ChangeBroadcaster*)
{
rebuildItemsFromContentList();
}
void rebuildItemsFromContentList()
{
clearSubItems();
if (isOpen() && subContentsList != nullptr)
{
for (int i = 0; i < subContentsList->getNumFiles(); ++i)
{
FileListTreeItem* const item
= new FileListTreeItem (owner, subContentsList, i, subContentsList->getFile(i), thread);
addSubItem (item);
}
addSubItem (new FileListTreeItem (owner, subContentsList, i,
subContentsList->getFile(i), thread));
}
}


Loading…
Cancel
Save