Private Sub GetXYCursor(edt As B4XFloatTextField) As Int()
Private joEditText, joLayout As JavaObject
Private xy(4) As Int
#Region NEW CHANGES in the project -----------
joEditText = edt.TextField
PaddingLeft = joEditText.RunMethod("getPaddingLeft", Null)
PaddingTop = joEditText.RunMethod("getPaddingTop", Null)
ScrollY = joEditText.RunMethod("getScrollY", Null)
Pos = joEditText.RunMethod("getSelectionStart", Null)
joLayout = joEditText.RunMethod("getLayout", Null)
#Region 'show line(bottom): the last visible line of text ---------------------------
Line = joLayout.RunMethod("getLineForOffset", Array As Object(txtField1.Text.Length))
LineCount = joLayout.RunMethod("getLineBottom", Array As Object(Line))
#End Region -------------------------------------------------------------------------
Line = joLayout.RunMethod("getLineForOffset", Array As Object(Pos))
LineBaseline = joLayout.RunMethod("getLineBaseline", Array As Object(Line))
LineBottom = joLayout.RunMethod("getLineBottom", Array As Object(Line))
LineTop = joLayout.RunMethod("getLineTop", Array As Object(Line))
xy(0) = joLayout.RunMethod("getPrimaryHorizontal", Array As Object(Pos)) + PaddingLeft
xy(1) = LineBaseline + PaddingTop - ScrollY 'base line
xy(2) = LineTop + PaddingTop - ScrollY 'top of the line
xy(3) = LineBottom + PaddingTop - ScrollY 'text bottom line
Return xy
#End Region ----------------------------------
End Sub