Complete noobie here, so please forgive my ignorance.
I’m looking to populate a PopUpMenu with the contents of a folder.
I’d like to list the files in that folder, but also have a hierarchy showing the folders and the files inside those folders.
I’ve looked at the example file named “FileBrowser” which other than specifying which folder to show, pretty much behaves as I’d like. The problem is that it is using ListBox as opposed to PopUpMenu. The latter does not have the same event handlers and therefore cannot be duplicated in it.
I found this Thread, and I would have posted the question there, but it is unfortunately closed:
There I found code by @Tim_Parnell which I’ve successfully used to populate my PopUpMenu, but it doesn’t work with Hierarchy:
dim fTarget as FolderItem = GetFolderItem("..") // user cancelled if fTarget = nil then return // FolderItem.Count is very intense and should not be used in a for loop. dim iCount as Integer = fTarget.Count for i as Integer = 1 to iCount dim fThis as FolderItem = fTarget.Item(i) // Folderitem error, let's not get a NOE if fThis = nil then continue PD_ExistingConfig.AddRow(fThis.DisplayName) next
But at the end, it seems the original poster @Richard_Summers was able to make it work as I want it (I believe). Unfortunately he did not post his final code. I tried to duplicate it but kept getting bugs.
I didn’t understand the comment by @Sascha_S “Try to add the RowTag after the AddRow Event, because you can’t add a RowTag to a Row before it even exists”
And perhaps that is what wasn’t working.
Any help would be greatly appreciated it.
Thank you much and stay safe.