I cannot get DirectoryChooser to work. I have never used it before, but I found a post by DonManfred in another thread with an example. Sadly one of the variables in his example isnt declared, so I guessed what it was.
But it doesnt work. I keep getting this:
java.lang.IllegalArgumentException: Folder parameter must be a valid folder
Here is my code:
Now, If I comment out the InitialDirectory, it works fine. However, when the dialog is showing, This happens in my logcat:
Thoughts?
But it doesnt work. I keep getting this:
java.lang.IllegalArgumentException: Folder parameter must be a valid folder
Here is my code:
B4X:
Sub cmdChooseMediaDIR_Click
Dim dirchoose As DirectoryChooser
dirchoose.Initialize
If txtMediaDIR.Text = "" Or Not(File.Exists(File.GetFileParent(txtMediaDIR.Text), "")) Then
txtMediaDIR.Text = File.DirApp
End If
dirchoose.InitialDirectory = txtMediaDIR.Text
dirchoose.Title = "Set Folder to bla bla bla"
dirchoose.Show(frm)
End Sub
Now, If I comment out the InitialDirectory, it works fine. However, when the dialog is showing, This happens in my logcat:
B4X:
Waiting for debugger to connect...
Program started.
Trying to connect
Unexpected event (missing RaiseSynchronousEvents): AFTER_SLEEP
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1336)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:199)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:84)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA$3.run(BA.java:246)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinCommonDialogs._showFolderChooser(Native Method)
at com.sun.glass.ui.win.WinCommonDialogs.showFolderChooser_impl(WinCommonDialogs.java:70)
at com.sun.glass.ui.win.WinApplication.staticCommonDialogs_showFolderChooser(WinApplication.java:304)
at com.sun.glass.ui.CommonDialogs.showFolderChooser(CommonDialogs.java:226)
at com.sun.javafx.tk.quantum.QuantumToolkit.showDirectoryChooser(QuantumToolkit.java:1534)
at javafx.stage.DirectoryChooser.showDialog(DirectoryChooser.java:103)
at anywheresoftware.b4j.objects.DirectoryChooserWrapper.Show(DirectoryChooserWrapper.java:43)
at md.cms3knorthmont.settingswindow._cmdchooselogodir_click(settingswindow.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:628)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA$1.run(BA.java:215)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
Error connecting.
Trying to connect
Error connecting.
Trying to connect
Thoughts?
Last edited: