Hello,
I need to change the background color of the edittext that has focus in a class.
The edittext event TextChange fires normally.
But the FocusChanged event fires only when the class ends.
The class is called by a button in Main activity to get the activity context.
Why the FocusChanged events are delayed?
Is there a way to change the background of the edittexts in my class when the focus change?
Thank you.
I need to change the background color of the edittext that has focus in a class.
The edittext event TextChange fires normally.
But the FocusChanged event fires only when the class ends.
The class is called by a button in Main activity to get the activity context.
Why the FocusChanged events are delayed?
Is there a way to change the background of the edittexts in my class when the focus change?
Thank you.
B4X:
Sub Class_Globals
Dim edt,edt2 As EditText
Dim cd As CustomDialog
Dim pnl As Panel
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
Sub Show
Dim ret As Int
edt.Initialize("edt")
edt2.Initialize("edt")
edt.TextColor=Colors.Black
edt.Color = Colors.LightGray
edt2.TextColor=Colors.Black
edt2.Color = Colors.LightGray
pnl.Initialize("")
pnl.AddView(edt, 1%x, 0%y, 90%x, 50dip)
pnl.AddView(edt2, 1%x, 60dip, 90%x, 50dip)
cd.AddView(pnl,0,0,100%x,30%Y)
ret = cd.Show("Event Test", "OK", "Cancel", "", Null)
Return ret
End Sub
Sub edt_EnterPressed
ToastMessageShow("enter",False)
End Sub
Sub edt_FocusChanged (HasFocus As Boolean)
ToastMessageShow("focus",False)
Dim wedt As EditText
wedt = Sender
wedt.Color = Colors.ARGB(255,Rnd(0,256),Rnd(0,256),Rnd(0,256))
End Sub
Sub edt_TextChanged (Old As String, New As String)
ToastMessageShow("changed",False)
End Sub