Lately I come across what I think not uninteresting problem which is a good exercise for the usage of Dynamic
. Assume you have files in a directory structure (a tree) like the one you find in the AddOns/Packages
subdirectory. Here a snip of it
Packages/BarCharts
|-- Charts.m
|-- Charts3D.m
|-- Kernel
| `-- init.m
|-- PacletInfo.m
`-- Usage.m
Packages/Benchmarking
|-- Benchmarking.m
|-- Kernel
| `-- init.m
`-- PacletInfo.m
Packages/BlackBodyRadiation
|-- BlackBodyRadiation.m
|-- Kernel
| `-- init.m
`-- PacletInfo.m
What I would like to have is a dynamically updating row of PopupMenu
's which let's me select a file or directory like this
There should be a possibility to select directories (like the Benchmarking/Kernel
) directory as well.
Note that not all PopupMenu
's are always visible. Their number depend on the depth of the selected file/directory. For instance consider this case
What I tried so far is to extract all files with FileNames
and use Gather
and replacement rules to convert them into a tree-structure. In this tree structure you can access then different levels and update the PopupMenu
's in dependence of each other.
I'm really keen to see nice* ideas of others.
*short, interesting, intuitive, mind-boggling