Guenter Becker Active Member Licensed User Longtime User Aug 25, 2025 #1 Hi, I have a B4J 10.30 project with a Main Form Style Decorated. In my AppStart I use this code: Code: Copy Dim jo As JavaObject = MainForm Dim e As Object = jo.CreateEventFromUI("javafx.event.EventHandler", "scroll", Null) jo.RunMethod("setOnScroll", Array(e)) If I start the code at the first time after starting B4J Suite there is no error. If I'm starting the code next time again without doing any changes I get this error: Code: Copy Waiting for debugger to connect... Program started. (RuntimeException) java.lang.RuntimeException: Method: setOnScroll not found in: anywheresoftware.b4j.objects.Form (RuntimeException) java.lang.RuntimeException: Method: setOnScroll not found in: anywheresoftware.b4j.objects.Form I' do not know why because the form is presented and working fine. Any Idea about the reason of the error and how to avoid it?
Hi, I have a B4J 10.30 project with a Main Form Style Decorated. In my AppStart I use this code: Code: Copy Dim jo As JavaObject = MainForm Dim e As Object = jo.CreateEventFromUI("javafx.event.EventHandler", "scroll", Null) jo.RunMethod("setOnScroll", Array(e)) If I start the code at the first time after starting B4J Suite there is no error. If I'm starting the code next time again without doing any changes I get this error: Code: Copy Waiting for debugger to connect... Program started. (RuntimeException) java.lang.RuntimeException: Method: setOnScroll not found in: anywheresoftware.b4j.objects.Form (RuntimeException) java.lang.RuntimeException: Method: setOnScroll not found in: anywheresoftware.b4j.objects.Form I' do not know why because the form is presented and working fine. Any Idea about the reason of the error and how to avoid it?
stevel05 Expert Licensed User Longtime User Aug 25, 2025 #2 Strange, I get the error straight after starting and loading. The Form object is B4j's implementation of the JavaFX Stage, which doesn't support setOnScroll. What you can do is add the scroll listener on the RootPane. B4X: Copy Dim jo As JavaObject = MainForm.RootPane Dim e As Object = jo.CreateEventFromUI("javafx.event.EventHandler", "scroll", Null) jo.RunMethod("setOnScroll", Array(e)) Last edited: Aug 25, 2025 Upvote 0
Strange, I get the error straight after starting and loading. The Form object is B4j's implementation of the JavaFX Stage, which doesn't support setOnScroll. What you can do is add the scroll listener on the RootPane. B4X: Copy Dim jo As JavaObject = MainForm.RootPane Dim e As Object = jo.CreateEventFromUI("javafx.event.EventHandler", "scroll", Null) jo.RunMethod("setOnScroll", Array(e))
Guenter Becker Active Member Licensed User Longtime User Aug 25, 2025 #3 Thank you, that solved it. Sometimes it's hard to be stupid. Upvote 0