Android Question B4XFloatTextField changing "my border style" when pressing "Reveal"

Magma

Expert
Licensed User
Longtime User
Hi there...

i have this code:
B4X:
public Sub StyleFloat(bbx As B4XFloatTextField)
    bbx.HintLabelSmallOffsetY=5dip
    bbx.HintLabelSmallOffsetx=5dip
    bbx.Update
    bbx.TextField.TextColor=Colors.Black
    bbx.TextField.SetColorAndBorder(Colors.White, 2dip, Colors.Black, 5dip)
    Dim edt As EditText = bbx.TextField
    edt.Padding = Array As Int (5dip, 5dip, 5dip, 5dip)
End Sub

That works ok when stylefloat(myb4xfloattextfield) but if this is a password field and want someone to reveal... loosing the style ! why?

Thanks in advance !
 
Solution
Method 1:
Track the PasswordRevealChanged Event
Method 2:
not tested, just saw it in the code
B4X:
If floatfield.lblClear.Tag = "reveal" Then
Log("Normal Text")
Else If floatfield.lblClear.Tag = "hide" Then
Log("Password Text")
End If

Alexander Stolte

Expert
Licensed User
Longtime User
loosing the style ! why?
Because a new edit text is created each time and the old one is discarded. So you have to execute the code for styling again each time.

Deep dive:
In the SwitchFromPasswordToRegular sub on the B4XFloatTextField.bas the sub CreateTextFieldAll is called, which then creates a new edittext.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Is there a way to check somehow at runtime if reveal pressed.. to execute my code again... ?

Or I need to edit the lib..?
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Method 1:
Track the PasswordRevealChanged Event
Method 2:
not tested, just saw it in the code
B4X:
If floatfield.lblClear.Tag = "reveal" Then
Log("Normal Text")
Else If floatfield.lblClear.Tag = "hide" Then
Log("Password Text")
End If
 
Upvote 1
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…