Android Question How can i access FocusChanged event of EditText?

Sreenadh OG

Member
Licensed User
hi all,
I have Custom Dialog box contain EditText, I want get FocusChanged Event of that EditText.
My code i s given below..
B4X:
Sub BtnAdd_Click
    Dim AddResonForHearing As CustomDialog
    Dim EditOrder As EditText    
    Dim EditDate As EditText
    Dim EditReason As EditText
    Dim ret As Int
    Dim PnlDialogHearing As Panel
    Dim BmpDialogAddPersn As Bitmap
    EditOrder.Initialize("EditOrder")
    EditDate.Initialize("EditDate")
    EditReason.Initialize("EditDate")
    EditOrder.InputType=EditOrder.INPUT_TYPE_TEXT   
    EditDate.InputType=EditDate.INPUT_TYPE_NONE
    EditReason.InputType=EditReason.INPUT_TYPE_NONE
    EditOrder.Hint="Order"
    EditDate.Hint="Date"
    EditReason.Hint="Reason"
    PnlDialogHearing.AddView(EditOrder,20,0,120,28)
    PnlDialogHearing.AddView(EditDate,20,40,120,28)
    PnlDialogHearing.AddView(EditReason,20,80,120,28)
    BmpDialogAddPersn.Initialize(File.DirAssets,"AddNewPerson.png")
    AddResonForHearing.AddView(PnlDialogHearing,10,0, 77%x, 60%y )
    ret = AddResonForHearing.Show("Add Reason", "Save", "Cancel","",BmpDialogAddPersn)
End Sub
Now I want to access FocusChanged Event for EditDate..


B4X:
'This code works only when Save_click(button),
Sub EditDate_FocusChanged (HasFocus As Boolean)
Dim strDate As String
bmp1.Initialize(File.DirAssets,"calendar.png")
    If HasFocus=True Then
        NextDate.Year = DateTime.GetYear(DateTime.Now)
        NextDate.Month = DateTime.GetMonth(DateTime.Now)  
        NextDate.DayOfMonth = DateTime.GetDayOfMonth(DateTime.Now)
        NextDate.Show("Enter The Month And Year", "Listed Case", "OK", "", "",bmp1)
        strDate= DateTime.Date(NextDate.DateTicks)
    End If
End Sub
 
Top