B4J Question [SOLVED] Exception with ListSelectionView and B4XDialog? ("Button.disable : A bound value cannot be set.")

walt61

Active Member
Licensed User
Longtime User
Hi all,

I hope someone can shed some light on this one. The attached project is intended to show a B4XDialog with a layout that contains a ListSelectionView from the jControlsFX9 library (the same happens with the jControlsFX library). When clicking either OK or Cancel on the B4XDialog, this exception is thrown:

B4X:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
A - entry=Entry 1 (<---- 'Log' line in the source code)
Time: 287
B - entry=Entry 1 (<---- 'Log' line in the source code)
Error occurred on line: 176 (B4XDialog)
java.lang.RuntimeException: Button.disable : A bound value cannot be set.
    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:141)
    at javafx.graphics/javafx.scene.Node.setDisable(Node.java:1803)
    at anywheresoftware.b4j.objects.NodeWrapper.setEnabled(NodeWrapper.java:231)
    at anywheresoftware.b4a.objects.B4XViewWrapper.setEnabled(B4XViewWrapper.java:157)
    at b4j.example.b4xdialog$ResumableSub_ShowCustom.resume(b4xdialog.java:619)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:156)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:514)
    at anywheresoftware.b4a.keywords.Common.access$0(Common.java:494)
    at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:568)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

Environment:
- Windows 10 21H2
- B4J version 9.80
- OpenJDK 11.0.1

Any help would be greatly appreciated!
 

Attachments

  • test.zip
    4.5 KB · Views: 143

stevel05

Expert
Licensed User
Longtime User
I can see why it is happening. ListSelectionView appears to internally bind the Enabled property of some views (I would guess the arrows) to another property (again a guess the enabled property of the View itself) which then does not allow the disabled properties of those views to be set in code. Hence the error.

On closing the B4xDialog code does:

B4X:
For Each v As B4XView In Background.GetAllViewsRecursive
    v.Enabled = False
Next

Which then raises the error you see.

As there is no access to the ListSelectionView code, the only way round it I can see is to add a try, catch block to the B4XDialog code to stop the crash. Not elegant. but it works.

I've attached a project which contains a Class called B4xDialogs_walt61 and a B4xLib containing just that class which you can add to your project to get around this issue.
And a modified version of your project that uses it.

Needless to say, this version of the dialog should only be used for this purpose and can be loaded at the same time as the standard B4xDialog as it is named differently.

Please test it thoroughly as I don't know what else you will want to do with the ListSelectionView and if there will be any other consequences.


Hope it helps.
 

Attachments

  • B4xDialogs_Walt61.zip
    5.3 KB · Views: 138
  • B4xDialogs_Walt61.b4xlib
    3.5 KB · Views: 162
  • testSL.zip
    4.5 KB · Views: 143
Last edited:
Upvote 0
Top