Android Question [B4X] Translate a B4XFloatTextField

hatzisn

Expert
Licensed User
Longtime User
Hey everyone,

I tried to add to the Localizator some code to translate the B4XFloatText hint text but I did not succeed. Here is what I have done:

Translate B4XFloatText:
    For Each v As View In Activity.GetAllViewsRecursive
        If v.Tag Is B4XFloatTextField Then
            Dim ft As B4XFloatTextField = v.Tag
            ft.HintText="OK CHANGED"
            Exit
        End If
    Next

I am debugging and I can see that the HintText was changed correctly but it does not show on screen

What I did next was this which suggests that probably it will be much more difficult to translate HintText since it is an ImageView. Is that correct? How can I do that?

Check B4XFloatText's views:
    For Each v As View In Activity.GetAllViewsRecursive
        If v.Tag Is B4XFloatTextField Then
            Log(v)
            Dim p As Panel = v
            For Each w As View In p.GetAllViewsRecursive
                Log(w)
                If w Is Label Then
                    Dim l As Label = w
                    If l.Text = "OLD TEXT" Then
                        l.Text = "OK CHANGED"
                    End If
                End If
            Next
            Exit
        End If
    Next
 

hatzisn

Expert
Licensed User
Longtime User
I also tried with this with no success:

Also tried this::
Public Sub LocalizeB4XFloatText(ft As B4XFloatTextField)
    ft.HintText = strings.GetDefault(ft.HintText, ft.HintText)
    ft.Text = strings.GetDefault(ft.Text, ft.Text)
End Sub
 
Upvote 0

edm68

Member
Licensed User
Longtime User
I think after you change the hint properties you need to update.
Example:

B4X:
ftfDlg1.HintText="1234567890"
ftfDlg1.HintColor=Colors.Cyan
ftfDlg1.Update
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I think after you change the hint properties you need to update.
Example:

B4X:
ftfDlg1.HintText="1234567890"
ftfDlg1.HintColor=Colors.Cyan
ftfDlg1.Update

Thanks a lot, this was correct the answer.
 
Upvote 0
Top