B4J Question Textarea ScrollChanged event?

Aegis

Member
Licensed User
Longtime User
Hello,
I'm trying to replicate a "json editor" interface, with a main textarea for writing, and another view on the side (probably a customlistview, or another textarea ) to mark line numbers, errors etc

I need to syncronize the scrolling of the 2 views, but there is no "scrollchanged" event on textarea...any other way to do it?
Thanks!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    Dim jo As JavaObject = TextArea1
    Dim event As Object = jo.CreateEventFromUI("javafx.beans.value.ChangeListener", "ScrollChanged", Null)
    jo.RunMethodJO("scrollTopProperty", Null).RunMethod("addListener", Array(event))
End Sub

Sub ScrollChanged_Event (MethodName As String, Args() As Object) As Object
    If MethodName = "changed" Then
        Dim NewPosition As Double = Args(2)
        Log(NewPosition)
    End If
    Return Null
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…