List Box - Opening files from the list

I currently can open a .csv file and populate a list box (i.e., ListBox1) with data. Now, I want to populate another Listbox (i.e., ListBox2) with a list of csv files in a default folder (i.e. documents). From there, i want to highlight one of the files listed and click an Open button. From there, it would populate ListBox1. I am trying to bypass the open dialog by providing the user with a list of .csv files in a default folder, where he/she can click the file of interest and choose open to populate the ListBox1.

Thanks,

John

Be careful. If you’re making a Mac app and plan on releasing it in the Mac App Store the methods for bypassing the open dialog are a nightmare. Essentially Apple telling you don’t.

If that’s not a concern, I’m pretty sure all the code you need is snippets floating around the documentation and example projects.

FolderItem Reference: http://documentation.xojo.com/index.php/FolderItem
The first example is exactly what you need for your listbox with the files.

Thanks Tim… That is exactly what I am doing. Now, I want to highlight a file and click a LOAD button for example. It would then open the file and place the data into ListBox2.

  • John

[quote=164180:@John Marsh]Thanks Tim… That is exactly what I am doing. Now, I want to highlight a file and click a LOAD button for example. It would then open the file and place the data into ListBox2.

  • John[/quote]
    Modify the code that reads the file names to store the path in the RowTag for that row as it adds the file name to the listbox. You can then retrieve the path when the user select the file and feed the path to the TextInputStream.Open call.

Dale,

Thanks. I implemented what you advised and it is working exactly how I want.

John

John,

you do not checked in the Examples folder ?

there was one that display the Desktop folder contents. Useful for understanding how to do it / custmize it for your needs (by merging the current code).