Hi there i want to set my edit text to shade red when field is empty or incorrect input, then when a user presses again to re-enter value it goes back to its default (original color which is white background). how can i do that?
Private Sub B4XFloatTextField1_TextChanged (Old As String, New As String)
If IsValid(New) Then
B4XFloatTextField1.mBase.SetColorAndBorder(xui.Color_Transparent, 2dip, xui.Color_Transparent, 2dip)
Else
B4XFloatTextField1.mBase.SetColorAndBorder(xui.Color_Transparent, 2dip, xui.Color_Red, 2dip)
End If
End Sub
Private Sub IsValid(Text As String) As Boolean
Return Text.StartsWith("A")
End Sub
Private Sub B4XFloatTextField1_TextChanged (Old As String, New As String)
If IsValid(New) Then
B4XFloatTextField1.mBase.SetColorAndBorder(xui.Color_Transparent, 2dip, xui.Color_Transparent, 2dip)
Else
B4XFloatTextField1.mBase.SetColorAndBorder(xui.Color_Transparent, 2dip, xui.Color_Red, 2dip)
End If
End Sub
Private Sub IsValid(Text As String) As Boolean
Return Text.StartsWith("A")
End Sub