native textField lost focus event problem

Hi there,

It seems that native text fields fire 2 events when they lost focus (ie if user clicks other buttons, or scroll views). First event’s phase is “submitted” and second event’s phase is “ended”. My question is; how do you handle this situation? I mean; If you process input message when event.phase is “submitted” then would it be a bit awkward to process them when control lost focus?

I am implementing some sort of real time chat application, and this usage pattern confuses me already… I already have a native textField, a scrollView to show past messages, a send button and a big native keyboard for input. I track event.phase == “submit” then process the input message buy this focus thing confuses me a bit. Am I missing something?

Thank you.

deniz. [import]uid: 11686 topic_id: 20803 reply_id: 320803[/import]

UPDATE:

This problem occurs only when you are testing it in corona simulator. If you run it on device, native text fields dont fire any events after you click other buttons or scroll views.

So this is some sort of false corona simulator behavior :slight_smile:

deniz. [import]uid: 11686 topic_id: 20803 reply_id: 81850[/import]

deniz - Process the textfield data on “ended” event and handle the keyboard focus in the “submitted” event.

If you click on a display object outside the textfield, it will execute “Ended” first and “Submitted” second.

[import]uid: 84539 topic_id: 20803 reply_id: 81893[/import]