FileTreeComponent: Using a filefilter, and double clicking


#1

Hi all, I’ve got a file tree component working quite well. I want to make it a bit better in two ways -

  1. Only display files of a certain type (for example, only wav files)
  2. When double clicking, rather than expanding that directory, re-create the file tree with that directory as root.
    Honestly I am a bit perplexed as to where to start with either. For the former, I think I need to apply a file filter when the file tree component is getting the list of files, but I’m not sure where this is done. For the latter, I think I need to override the behavior in treeviewitem::itemDoubleClicked(), but I’m not sure what the proper syntax is for “set the root directory to x”. Any tips on where to look? Thanks very much!

-Colin


#2

Hello,

For the former, you can use a wildcard filter that you apply while construction the DirectoryContentsList.
For assigning a new path each time you double click, maybe use DirectoryContentsList’s setDirectory & refresh() member ?

So now you have a way to stepin by double clicking, you need a way to stepout !
For this, check out FileBrowserComponent class for some hints.

I have made such class for a client, but as it’s commercial I can’t share code. Though feel free to ask questions.

Salvator


#3

I posted my own FileTreeComponentEx a few days ago, which has several of options, including the ones you want. Its free, just check my latest posts. :wink:

Wk


#4

Thanks for the info to you both! I will see what I can come up with. William, in response to your wondering if anyone would make use of your example… keep in mind that just having it up on the board will make it useful to users indefinitely, even if lots of people aren’t using it immediately!

-Colin


#5