' Code of Utility Class
Sub Process_Globals
End Sub
' Code of StyleEditText Utility Function
Public Sub StyleEditText(parent As B4XView)
For Each v As B4XView In parent.GetAllViewsRecursive
If TypeOf(v) Is EditText Then
v.AddHandler("EditText_FocusChanged", "EditText_FocusChanged_Event")
End If
Next
End Sub
Sub EditText_FocusChanged_Event(HasFocus As Boolean)
Dim et As EditText = Sender
If HasFocus Then
Log($"${et.Text} gained focus"$)
Dim cd As ColorDrawable
cd.Initialize2(xui.Color_White, DipToCurrent(8), DipToCurrent(2), xui.Color_ARGB(255, 255, 0, 0))
et.Background = cd
Else
Log($"${et.Text} lost focus"$)
Dim cd As ColorDrawable
cd.Initialize2(xui.Color_White, DipToCurrent(8), DipToCurrent(2), xui.Color_Transparent)
et.Background = cd
End If
End Sub