B4J Question Filechooser how to detect Cancel click

ThRuST

Well-Known Member
Licensed User
Longtime User
Hi I wonder how to detect cancel click in filechooser? I tried this

Code: Copy
Dim fc As FileChooser
fc.Initialize
Dim filename As String = fc.ShowOpen(MainForm)

If fc = fx.DialogResponse.CANCEL Then
    ' code
End If

Thanks,
ThRuST
 
And for all the lamers out there that is new to programming here's the solution :D

Code: Copy
Dim fc As FileChooser
fc.Initialize
Dim filename As String = fc.ShowOpen(MainForm)

If filename = "" Then
' No file choosen

Else
' User choosed a filename

End If
 
Upvote 0
That happens, its normal for us to overcomplicated ourselves,

watch out when you copy paste from the forums tags, they will mess the formatting, look at your 2nd line!
 
Upvote 0
Btw how to change the default extension and path? :rolleyes: (Please do not start a new question for this follow-up questions) ;)
 
Upvote 0
Enrriqueee, pleeaassee Amiiigo, hurryy to answerrr myy quesstion. Coding caanoottt waitt :D
 
Upvote 0
i am sorry!!

this is how.
Code: Copy
    fc.Title="Select Photo"
    fc.InitialDirectory = "C:\Proyectos"
    fc.SetExtensionFilter("Image",Array As String("*.jpg","*.png","*.bmp"))
 
Upvote 0
Stole this code from Fabrice La

Code: Copy
fc.InitialFileName = "excelfile.xls"
fc.SetExtensionFilter("Excel Files",Array As String("*.xls"))
 
Upvote 0
Back
Top