Gave up on Dev C++ and minor bug/doc problems in JUCE


I gave up on Dev C++ and got Visual C++ Express (Thanks Modular for the instructions and files), I just could not debug a problem with the TreeView with it…Jules if I am the last Dev C++ user then you can stop worry abou it :twisted:

There is either a small bug or a documentation problem with DirectoryIterator. If you don’t choose to iterate in recursive mode then it will not return sub directories only files…I need to get one level of subdirectories so I ended up using File:findChildFiles

Problem is that you pass false to findChildFiles and tell it not to searc for directories in the DirectoryIterator constructor…if its not a bug then the documentation should say it clearly

directory.findChildFiles (filesFound, [color=red]false[/color], false, wc);

if (isRecursive)
    directory.findChildFiles (filesFound, true, false);

Another thing I found out is that the tree view keep asking for number of children and rebuilding the children nodes again and again. This is not very efficient but it is a must then the documentation should warn the users to make sure the methods they provide are efficient


Well the DirectoryIterator never returns directories, only files - it does say that in the help but I guess I could clarify that a bit. (You’re misunderstanding the code that you quoted here - that’s just used internally so it knows where to search). I might add an option to look for directories when I get a moment, but if you’re not recursing, then findChildFiles is the best thing to use.

And if your treeview’s inefficient, I think you’re probably telling it to update too much, or setting the root node repeatedly? It’ll only recreate the nodes when it’s told that they’ve changed…


I used findChildFiles to solve the problem, its just that DirectoryIterator had better PR in the docs so I tried it first 8)

About the treeview, I am not sure, I put a breakpoint in the getnumchild and it was called about 3 times for the root node, I didn’t do anything to make it work like this. Anyway I didn’t get to the bottom of it just added a flag to my node and just returned the same value if it gets called again instead of searching again for sub directories.

Bottom line all is well now and its really fun to use the library so far!


Cool - if you do find a problem with the treeview, let me know.


Found a problem (or I am not using the treeview correctly)

virtual void selectedRowsChanged (int lastRowSelected);

Is not called for treview selection like it should since treeview is a listbox

Code from juce_treeview.cpp:

void TreeView::nodeSelectionChanged()



what is //xxx? :roll: