if I have a modal dialog, and in its event I want to open a fileDialog can this be done ?
currently my dialog when call to show sub, return immidiatly without openning the file dialog
see this code (the first addFile is working, but the one from the event does not it return immidiatly as if the user press the cancel button)
currently my dialog when call to show sub, return immidiatly without openning the file dialog
see this code (the first addFile is working, but the one from the event does not it return immidiatly as if the user press the cancel button)
B4X:
Sub btn_folders_Click
Utilities.LogM(0,"open folders dialog")
Dim nd As CustomDialog
Dim ret As Int
Dim p As Panel
Dim l As List : l = DBHandler.getFolders
' build table
p.Initialize("")
tbl_folders.Initialize(Me,"cb",1)
tbl_folders.AddToActivity(p,0,10,100%x,100%y-50)
tbl_folders.SetHeader(Array As String("Folders"))
For i = 0 To l.Size -1
tbl_folders.AddRow(Array As String(l.Get(i)))
Next
addFile
nd.AddView(p,0,0,100%x,100%y)
ret = DialogResponse.CANCEL
ret = nd.Show("You have " & l.Size & " Folders", "Ok", "", "", Null)
End Sub
Sub cb_CellClick (Col As Int, Row As Int)
Utilities.LogM(0,"Folders CellClick: " & Col & " , " & Row)
Utilities.LogM(0,"cell value:" & tbl_folders.GetValue(Col, Row))
End Sub
Sub cb_HeaderClick (Col As Int)
Utilities.LogM(0,"HeaderClick: " & Col)
addFile
End Sub
' open file dialog and choose a file to ad to the table
Sub addFile
Utilities.LogM(0,"AddFile: ")
Dim nd As FileDialog
nd.FilePath = File.DirRootExternal
nd.ShowOnlyFolders = True
Dim ret As Int
ret = DialogResponse.CANCEL
ret = nd.Show("Please choose the base folder of your mp3 files","Ok","Cancel","",Null)
If (ret = DialogResponse.POSITIVE) Then
Utilities.LogM(0,"User press ok")
tbl_folders.AddRow(Array As String(nd.FilePath))
Else
Utilities.LogM(0,"User press cancel")
End If
End Sub