Guenter Becker Active Member Licensed User Longtime User Mar 12, 2026 #1 Hey, is anyone able to tell me in B4J how to clear the complete text in the codearea? Code: Public Sub ReplaceText(Start As Int, ThisEnd As Int, Text As String) JO.RunMethod("replaceText",Array As Object(Start, ThisEnd, Text)) End Sub Code: Public Sub Clear JO.RunMethod("replaceText",Array As Object(0, Length, " ")) End Sub Code: Waiting for debugger to connect... Program started. Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events. Unexpected event (missing RaiseSynchronousEvents): textchanged_event java.lang.Exception: Stack trace at java.base/java.lang.Thread.dumpStack(Thread.java:2282) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:199) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) 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.b4j.object.JavaObject$1.invoke(JavaObject.java:238) at jdk.proxy1/jdk.proxy1.$Proxy1.changed(Unknown Source) at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786) at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.MultiGuard.close(Guard.java:83) at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118) at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104) at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18) at org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105) at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786) at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.value.ValBase.invalidate(ValBase.java:32) at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.Suspendable.suspendWhile(Suspendable.java:49) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateMulti(GenericEditableStyledDocumentBase.java:218) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateSingle(GenericEditableStyledDocumentBase.java:210) at org.reactfx.util.Tuple3.exec(Tuple3.java:43) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.replace(GenericEditableStyledDocumentBase.java:145) at org.fxmisc.richtext.model.SimpleEditableStyledDocument.replace(SimpleEditableStyledDocument.java:10) at org.fxmisc.richtext.GenericStyledArea.replace(GenericStyledArea.java:1570) at org.fxmisc.richtext.GenericStyledArea.replaceText(GenericStyledArea.java:1556) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:673) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) 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.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:109) at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1) at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
Hey, is anyone able to tell me in B4J how to clear the complete text in the codearea? Code: Public Sub ReplaceText(Start As Int, ThisEnd As Int, Text As String) JO.RunMethod("replaceText",Array As Object(Start, ThisEnd, Text)) End Sub Code: Public Sub Clear JO.RunMethod("replaceText",Array As Object(0, Length, " ")) End Sub Code: Waiting for debugger to connect... Program started. Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events. Unexpected event (missing RaiseSynchronousEvents): textchanged_event java.lang.Exception: Stack trace at java.base/java.lang.Thread.dumpStack(Thread.java:2282) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:199) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) 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.b4j.object.JavaObject$1.invoke(JavaObject.java:238) at jdk.proxy1/jdk.proxy1.$Proxy1.changed(Unknown Source) at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786) at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.MultiGuard.close(Guard.java:83) at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118) at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104) at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18) at org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105) at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786) at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.value.ValBase.invalidate(ValBase.java:32) at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.Suspendable.suspendWhile(Suspendable.java:49) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateMulti(GenericEditableStyledDocumentBase.java:218) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.updateSingle(GenericEditableStyledDocumentBase.java:210) at org.reactfx.util.Tuple3.exec(Tuple3.java:43) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.replace(GenericEditableStyledDocumentBase.java:145) at org.fxmisc.richtext.model.SimpleEditableStyledDocument.replace(SimpleEditableStyledDocument.java:10) at org.fxmisc.richtext.GenericStyledArea.replace(GenericStyledArea.java:1570) at org.fxmisc.richtext.GenericStyledArea.replaceText(GenericStyledArea.java:1556) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:673) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) 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.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:109) at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1) at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
teddybear Well-Known Member Licensed User Mar 13, 2026 #2 I'm curious why you replace text using javaobject instead of the method ReplaceText of CodeArea. This error only appears in the debug mode of B4xPages project. To avoid this error in debug mode, you need to modify the class CodeArea. B4X: ' Dim Event As Object = JO.CreateEvent("javafx.beans.value.ChangeListener","TextChanged","") Dim Event As Object = JO.CreateEventFromUI("javafx.beans.value.ChangeListener","TextChanged","") This also applies to this thread. Last edited: Mar 13, 2026 Upvote 1
I'm curious why you replace text using javaobject instead of the method ReplaceText of CodeArea. This error only appears in the debug mode of B4xPages project. To avoid this error in debug mode, you need to modify the class CodeArea. B4X: ' Dim Event As Object = JO.CreateEvent("javafx.beans.value.ChangeListener","TextChanged","") Dim Event As Object = JO.CreateEventFromUI("javafx.beans.value.ChangeListener","TextChanged","") This also applies to this thread.
Guenter Becker Active Member Licensed User Longtime User Mar 13, 2026 #3 teddybear said: I'm curious why you replace text using javaobject instead of the method ReplaceText of CodeArea. This error only appears in the debug mode of B4xPages project. To avoid this error in debug mode, you need to modify the class CodeArea. B4X: ' Dim Event As Object = JO.CreateEvent("javafx.beans.value.ChangeListener","TextChanged","") Dim Event As Object = JO.CreateEventFromUI("javafx.beans.value.ChangeListener","TextChanged","") This also applies to this thread. Click to expand... I love people who knows more than I do. Thank you it works. Upvote 0
teddybear said: I'm curious why you replace text using javaobject instead of the method ReplaceText of CodeArea. This error only appears in the debug mode of B4xPages project. To avoid this error in debug mode, you need to modify the class CodeArea. B4X: ' Dim Event As Object = JO.CreateEvent("javafx.beans.value.ChangeListener","TextChanged","") Dim Event As Object = JO.CreateEventFromUI("javafx.beans.value.ChangeListener","TextChanged","") This also applies to this thread. Click to expand... I love people who knows more than I do. Thank you it works.