# Simple file browser

**URL:** <https://root-forum.cern.ch/t/simple-file-browser/41285>\
**Category:** Newbie\
**Tags:** graphics\
**Created:** [September 3, 2020, 3:53pm UTC](https://root-forum.cern.ch/t/simple-file-browser/41285 "2020-09-03T15:53:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![StephenAdler](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/stephenadler/32/35568_2.png) [@StephenAdler](https://root-forum.cern.ch/u/StephenAdler)\
**Post date:** [September 3, 2020, 3:53pm UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/1 "2020-09-03T15:53:41Z")

</div>

I want to write some code into my .C macro which when called, pops up a file browser which I can use to navigate my file system and choose a file. When I choose the file, a string is returned with the full path and filename of the file I chose. Can this be done with a few lines of code? Something along the lines of java’s file chooser and the example code found here…

[https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html](https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 3, 2020, 4:02pm UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/2 "2020-09-03T16:02:38Z")

</div>

You can open a TBrowser… ?

---

<div class="post-metadata">

**Author:** ![StephenAdler](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/stephenadler/32/35568_2.png) [@StephenAdler](https://root-forum.cern.ch/u/StephenAdler)\
**Post date:** [September 3, 2020, 10:47pm UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/3 "2020-09-03T22:47:50Z")

</div>

Thanks, I tried creating a TBrowser object, but It’s not clear how I can select a file using the GUI (The ROOT Object Browser GUI). The TBrowser is a good tool for looking at root objects like tuples or histograms I believe. In the TBrowser GUI, there is a file menu. When you click on it, in the dropdown menu, there is an “open…” command. When I click on that, I get the typical directory tree surfing file chooser GUI. I would like to just create that GUI which would allow me to select a file. When I click on the open button, the GUI should close and return a string with the full filename of the file I selected. Any pointers on the name of the GUI object which is used when I click on the “open…” command? Or any pointers to the right document to read through which details the root GUI classes?

Thanks!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 4, 2020, 6:55am UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/4 "2020-09-04T06:55:55Z")

</div>

I think @bellenot can help you when he will be back.

---

<div class="post-metadata">

**Author:** ![StephenAdler](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/stephenadler/32/35568_2.png) [@StephenAdler](https://root-forum.cern.ch/u/StephenAdler)\
**Post date:** [September 4, 2020, 3:32pm UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/5 "2020-09-04T15:32:27Z")

</div>

Thanks, no hurry on this one. Cheers.

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [September 30, 2020, 9:09am UTC](https://root-forum.cern.ch/t/simple-file-browser/41285/6 "2020-09-30T09:09:40Z")

</div>

Check the `${ROOTSYS}/tutorials/gui/guitest.C` tutorial, in particular the `File List...` test
