Android Question Textbox and HasFocus event

Oldmanenzo

Member
Licensed User
Longtime User
I have a problem to manage two textbox controls, also because there isn't a click event.
I have the need to display the date selected by the lib "Dialog" and so far so good, the work returns to exactly the selected date and places it in the first textbox as a start date.
The problem is that if I want to change the date, "HasFocus" event does not work and I put the cursor where you corrected the date without letting me see the "dialog" but rather the virtual keyboard. If I press forward it makes me appear the dialog but then automatically changes the end date on the textbox.
I do not know how to handle it and with what event is possible.
I also tried with "EnterPressed" event but obviously does not work.
These are the two functions. I tried to give focus to a label, a button, but to no avail.
Sorry for the English.

B4X:
'Initial start date
Sub TxtDataInizio_FocusChanged (HasFocus As Boolean)
    If HasFocus Then
        TxtDataInizio.Text =Varie.DateReturn ("Selezionare la data inizio lavoro", Bmp)
        If TxtDataInizio.Text <>"" Then
'            automatically it takes year and month for 2 textbox
            Dim ticks As Long=DateTime.DateParse(TxtDataInizio.Text)
            anno= DateTime.GetYear(ticks)
            TxtMese.Text =DateUtils.GetMonthName(ticks)
        End If
    End If
    HasFocus=False
End Sub

'End final date
Sub TxtDatafine_FocusChanged (HasFocus As Boolean)
    If HasFocus Then
        TxtDatafine.Text =Varie.DateReturn ("Selezionare la data fine lavoro", Bmp)
        If TxtDatafine.Text <>"" And TxtDataInizio.Text <>"" Then
            'Check if the start date is greater than the final.....error if retvalue = true
            Dim retvalue As Boolean = Varie.DistanceFromTime (TxtDataInizio.Text, "00:00:00", TxtDatafine.Text, "00:00:00")
            If retvalue Then
                Msgbox ("La data di inizio non puo essere superiore a quella di fine","Errore")
                TxtDatafine.Text =""
            End If
        End If
    End If
    HasFocus=False
End Sub
 

Oldmanenzo

Member
Licensed User
Longtime User
SOLVED
two textbox
edit mode = NONE
and exit with request focus on img (function how button)

B4X:
Sub TxtDataInizio_FocusChanged (HasFocus As Boolean)
    If HasFocus Then
        TxtDataInizio.Text =Varie.DateReturn ("Selezionare la data inizio lavoro", Bmp)
        If TxtDataInizio.Text <>"" Then
'            automatically it takes year and month for 2 textbox
            Dim ticks As Long=DateTime.DateParse(TxtDataInizio.Text)
            anno= DateTime.GetYear(ticks)
            TxtMese.Text =DateUtils.GetMonthName(ticks)
        End If
    End If
    ImgExit.RequestFocus
End Sub
 
Upvote 0
Top