Bug? DirectoryChooser cause an error using B4XPages

Pitag

Member
Licensed User
Longtime User
Hi to all

i create the following simple code. Using directory choose cause an error
Using DirectoryChooser:
Sub btnFolder_Click
    Dim dc As DirectoryChooser
    dc.Initialize
    dc.Title = "Choose a Folder"
    Dim folder As String = dc.Show(B4XPages.GetNativeParent(Me))
    Log(folder)
End sub

The same code using FileChooser works without error.
Using FileChooser:
Sub btnFolder_Click
    Dim dc As FileChooser
    dc.Initialize
    dc.Title = "Choose a file"
    Dim folder As String = dc.Showopen(B4XPages.GetNativeParent(Me))
    Log(folder)
End Sub

Maybe a bug or something i'm missing?

Using the first example, when the button that activates the DirectoryChooser is pressed, an error is raised but the directory window is shown, and is possible to choose one. After clicking ok the correct folder is logged, but another error is raised closing the program.

This is the complete log of the error:

Error:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
Unexpected event (missing RaiseSynchronousEvents): mainform_focuschanged
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:167)
    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:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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:315)
    at com.sun.glass.ui.CommonDialogs.showFolderChooser(CommonDialogs.java:226)
    at com.sun.javafx.tk.quantum.QuantumToolkit.showDirectoryChooser(QuantumToolkit.java:1577)
    at javafx.stage.DirectoryChooser.showDialog(DirectoryChooser.java:103)
    at anywheresoftware.b4j.objects.DirectoryChooserWrapper.Show(DirectoryChooserWrapper.java:60)
    at b4j.example.b4xmainpage._btnfolder_click(b4xmainpage.java:80)
    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:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    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:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)
D:\2021
Errore nella linea: 406 (B4XPagesManager)
java.lang.NullPointerException
    at b4j.example.b4xpagesmanager._mainform_focuschanged(b4xpagesmanager.java:534)
    at b4j.example.b4xpagesdelegator._mainform_focuschanged(b4xpagesdelegator.java:77)
    at b4j.example.main._mainform_focuschanged(main.java:124)
    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:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at anywheresoftware.b4a.shell.Shell$1.run(Shell.java:206)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)
Errore nella linea: 406 (B4XPagesManager)
java.lang.NullPointerException
    at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:373)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:181)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    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:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)
 

Pitag

Member
Licensed User
Longtime User
Hi Erel

attached a small project. I'm using b4j 8.80
 

Attachments

  • DcTest.zip
    2.8 KB · Views: 243
Cookies are required to use this site. You must accept them to continue using the site. Learn more…