Bug? FocusChanged on EditText doesnot fire when moving to aButton.

MrKim

Well-Known Member
Licensed User
Longtime User
B4A Version 4.
FocusChanged event fires when moving from one EditText to another, but if you move from an EditText to a Button the FocusChanged event for the EditText NEVER fires. Not before OR after the Button_Click Event.
 

stevel05

Expert
Licensed User
Longtime User
On a device without a keyboard or other control method, the Focus does not leave the EditText when you press the button. That is the expected behaviour See the section on TouchMode on this page: http://developer.android.com/reference/android/view/View.html.

If it is important to you, it is possible to set the button to accept the focus in touch mode using JavaObject

B4X:
    Dim JO As JavaObject = Button1
    JO.RunMethod("setFocusableInTouchMode",Array(True))

The button will then be highlighted (Focused) when you leave the EditText and the EditText Focus changed event will fire.
 

MrKim

Well-Known Member
Licensed User
Longtime User
On a device without a keyboard or other control method, the Focus does not leave the EditText when you press the button. That is the expected behaviour See the section on TouchMode on this page: http://developer.android.com/reference/android/view/View.html.

If it is important to you, it is possible to set the button to accept the focus in touch mode using JavaObject

B4X:
    Dim JO As JavaObject = Button1
    JO.RunMethod("setFocusableInTouchMode",Array(True))

The button will then be highlighted (Focused) when you leave the EditText and the EditText Focus changed event will fire.
Thanks for that. I solved it another way, just run the focus code in the button click event. Just wanted to report what I thought was a bug.
 
Top