B4J Question [SOLVED]In B4J FileChooser needs to be able to select a directory

MrKim

Well-Known Member
Licensed User
Longtime User
That's it. You can't select a directory unless it has a file in it.
 

MrKim

Well-Known Member
Licensed User
Longtime User
2 choosers:
    Public fchoose As FileChooser
    Public dirchoose As DirectoryChooser
Do you mean a combination of the two?
Well, duh - didn't know that existed. In my defense another post led me to believe it wasn't possible.
 
Upvote 0

jkhazraji

Active Member
Licensed User
Longtime User
B4X:
 Dim fc As FileChooser
    fc.Initialize
    fc.Title = "Select a Directory (Open any file within the directory)"
    Dim selectedFile As String
    selectedFile = fc.ShowOpen(MainForm)
   
    If selectedFile <> "" Then
        Dim directoryPath As String
        directoryPath = File.GetFileParent(selectedFile)
        Log("Selected Directory: " & directoryPath)
        ' You can now use the selected directory path
    Else
        Log("No file selected.")
    End If
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…