B4J Question FileChooser only works within the apps folder?

Cableguy

Expert
Licensed User
Longtime User
Hi guys,

I'm having an issue with filechooser....
It seems to only work within the app folder, as if it was its root...

I get the fallowing error:
B4X:
Program started.
D:\B4X\B4j\Under Development\LanguageTool\Files\Form1.bjl
main._openlayout_action (java line: 98)
java.io.FileNotFoundException: \Form1.bjl
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:206)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:43)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:76)
    at anywheresoftware.b4j.objects.ScrollPaneWrapper.LoadLayout(ScrollPaneWrapper.java:82)
    at b4j.example.main._openlayout_action(main.java:98)
    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:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA$2.run(BA.java:165)
    at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(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$149(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)

my code is:

B4X:
    openFile.Initialize
    openFile.InitialDirectory = File.DirApp
    openFile.SetExtensionFilter("Layouts",Array("*.bjl","*.fxml"))
    openFile.Title ="Choose the layout"
    thisLayout = openFile.ShowOpen(MainForm)
    If thisLayout <>"" Then
        Log(thisLayout)
        ScrollPane1.LoadLayout(thisLayout.SubString(thisLayout.LastIndexOf("\")),-1,-1)
    Else
        Label1.Text="No Layout has been selected."
        labeltimer.Enabled = True
    End If

As I said, this works if I choose a file in any child folder under the apps folder, but not in others
[EDIT] I've found that this error is not related to file chooser; but rather to the loadlayout method, so I will create a new thread for this new issue.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…