File Picker not working

Dogbonesix

Active Member
Licensed User
Longtime User
I am trying to use the file picker and thought it would work much as the Date Picker but I must be doing something wrong.

My Code:
Dim xdir As String
xdir = "/mnt/sdcard/Docments"
Dim fd As FileDialog
Dim ret As Int
fd.FastScroll = True
fd.FilePath = xdir
'fd.FileFilter = ".txt" ''''Remmed as I want all file
'fd.ChosenName = "SomeFile.txt"

I am not sure what fd.chosenName is as I never get any opportunity to chose a file. Nothing appears at all on the screen although it does execute because I can stop the process at any step - just never see anything on the screen. Is there a full example somewhere? Or is it just too simple...

Thanks
 

Dogbonesix

Active Member
Licensed User
Longtime User
File Picker Working

This code works that I got from DialogsDemo.b4a
Slightly modified below:
Dim ret As String
Dim fd As FileDialog
fd.FastScroll = True
'fd.ShowOnlyFolders = True
'fd.FilePath = File.DirRootExternal ' also sets ChosenName to an emtpy string
fd.FilePath = "/mnt/sdcard/Documents/" ' also sets ChosenName to an emtpy string
'fd.ShowOnlyFolders = true
'fd.FileFilter = ".txt" ' for example or ".jpg,.png" for multiple file types
ret = fd.Show("B4A File Dialog", "Yes", "No", "Maybe", Bmp)
ToastMessageShow(ret & " : Path : " & fd.FilePath & CRLF & "File : " & fd.ChosenName, False)

For whatever reason the code from WiKi was not clear enough. I did have a spelling error - but I would work with the spelling error just wouldn't find as much.
 
Upvote 0
Top