B4A Library [B4X] BR_B4XFloatTextField

Lucas Siqueira

Active Member
Licensed User
Hello everyone!
With the example of Erel library and with the help of Biswajit, we made some modifications to the original B4XFloatTextField library, recreating it with some modifications in the visual transforming into BR_B4XFloatTextField.

See how the example looked:
Note: I have no iphone to be able to test. so I only tested it on B4A and B4J.

The first two fields are the original ones (B4XFloatTextField), all the others are the modified ones (BR_B4XFloatTextField).

See how the example looked:

MainPage 2020-09-03 21-51-19.gif
 

Attachments

Glen Ponder

Member
Licensed User
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:
B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("1")
    BRB4XFloatTextField11.TextField.SetTextAlignment("CENTER", "CENTER")
End Sub
Then the text is center aligned at runtime.

many thanks
 

Lucas Siqueira

Active Member
Licensed User
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:
B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("1")
    BRB4XFloatTextField11.TextField.SetTextAlignment("CENTER", "CENTER")
End Sub
Then the text is center aligned at runtime.

many thanks
I will check to correct
 

Lucas Siqueira

Active Member
Licensed User
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:
B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("1")
    BRB4XFloatTextField11.TextField.SetTextAlignment("CENTER", "CENTER")
End Sub
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

1599579814011.png
 

Attachments

rraswisak

Active Member
Licensed User
Just want to report that anchor does not work when layout was loaded in SplitPane (B4J). Both use same anchor

1601046228792.png


Upper is BR_B4XFloatTextField
Below is B4XFloatTextField (XUI Views)
 
Top