fantastic, I have been looking for this for months. only problem is that the Horizontal/Vertical alignment does not seem to be applied.
In your example provided I am trying to center on the Horizontal alignment in the designer but at runtime the text is still left aligned.
In code if I add:
[CODE lang="b4x" title="B4XMainPage" highlight="4"]Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("1")
BRB4XFloatTextField11.TextField.SetTextAlignment("CENTER", "CENTER")
End Sub[/CODE]
Then the text is center aligned at runtime.
many thanks
the
SetTextAlignment function was added to adjust the alignment, in the tbm designer two fields were added for vertical and horizontal alignment.
the library is public, feel free to change, and post the improvements
BRB4XFloatTextField11.SetTextAlignment("CENTER", "CENTER")
'The possible values are:
'Vertical--> TOP, CENTER, BOTTOM.
'Horizontal--> LEFT, CENTER, RIGHT.
Public Sub SetTextAlignment(vertical As String, horizontal As String)
#if B4J
Dim TextAlignment As String = vertical
If Not(vertical=horizontal) Then TextAlignment=TextAlignment&"_"&horizontal
Dim jo1 = mTextField As JavaObject
Log("TextAlignment:"&TextAlignment)
jo1.RunMethod("setAlignment", Array As Object(TextAlignment))
#Else
mTextField.SetTextAlignment( vertical , horizontal )
#End If
End Sub