File Browser Example Code

I’m new to Xojo, but not programming. I’ve used PowerBASIC along with a GUI development environment called EZGUI for many years.

But, in switching over to Xojo, I do have some pretty basic questions. I’ve looked at documentation, but haven’t found exactly what I’m looking for.

I need to read the directory of the hard drive on the PC and show the folders and files in a Listbox, from which I can select a desired file to read into my program.

I’ve seen reference to an example program called Filebrowser, but I can’t find this example code. I also tried using some of the example code from the documentation but found that this codes throws errors up. It appears that this example code isn’t really ‘complete’ code that can be run.

Can someone please point me to some example code that I can actually run, that will do what I need?

John Rayfield, Jr.

When you are presented with the New project window, select Examples and then open Files and the Filebrowser example is in there.

1 Like

For 2021r3.1, the example appears to have a small bug, to fix do this:

  1. Open the project in the IDE
  2. In the IDE navigator, click on the DriveBrowserList instance called FileListing, to highlight it
  3. In the Inspector, enable the “Allow Expandable Rows” option.

Now when you run the project, each row in the Volumes list will have the disclosure triangle so you can navigate into a volume’s contents.

You should also study the RowExpanded event handler in the DriveBrowserList.

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.