Android Question _FocusChanged does not fire

brodmuehler

Member
Licensed User
Longtime User
Hallo

I have an edittext which is called edtPilot1 and dimed in Globals. I wrote the following sub ...

Sub edtPilot1_FocusChanged (HasFocus As Boolean)

If HasFocus = False Then
Log(HasFocus)
Else If HasFocus = True Then
Log(HasFocus)
End If

End Sub


Problem I have now that this sub is never called.

Could you please help or point me towards other threads that might contain a solution and explanation.

Thanks a lot in advance.
Kind regards
René
 

brodmuehler

Member
Licensed User
Longtime User
Thanks for the quick response.I have to confess I do not understand your question. What do you mean by "event name" poperty?
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
I have not used the designer.

In Globals i put

Dim edtPilot1 As EditText

Then I wrote the sub using the extension "_FocusChanged(....) as shown above. That is all I did.

Do I have to declare, dim or save the event somewhereelse?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
When you add views in the code you must declare then in Globals as you did.
Dim edtPilot1 As EditText

Then you must initialize it as suggested by margret.
edtPilot1.Initialize("edtPilot1")
And you must add it to the Activity or a Panel.
Activity.AddView(edtPilot1, 10dip, 10dip, 150dip, 50dip)
AddView(View, Left, Top, Width, Height)
If the EditText view already has the focus and you touch it the event is not fired.
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Sorry sorry sorry...

It's all my fault. I initialized the view wrongly. Margret gave me the right hint. Great, it seems to work now.

Thanks a lot for all your help.
 
Upvote 0
Top