Native newTextBox Bug @ Event.phase = began

Hi guys,

I notice that for ‘newTextBox’, the listener does not get triggered when the field is selected (in Mac simulator Version 2013.2114 (2013.12.28) ). The expected result is ‘event.phase = began’ to be triggered when the field is selected.

But the ‘event.phase = began’ is only shown when something is typed into the text box It will also show ‘event.phase = editing’ at the same time, since it is also editing.

The ‘newTextField’ is working fine.

Sample Code (taken from the sample codes) :

local function fieldHandler( textField ) return function( event ) print(event.phase) if ( "began" == event.phase ) then -- This is the "keyboard has appeared" event -- In some cases you may want to adjust the interface when the keyboard appears. elseif ( "ended" == event.phase ) then -- This event is called when the user stops editing a field: for example, when they touch a different field elseif ( "editing" == event.phase ) then elseif ( "submitted" == event.phase ) then -- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard print( "Input : " .. textField().text ) -- Hide keyboard native.setKeyboardFocus( nil ) end end end defaultField = native.newTextBox( 10, 30, 180, tHeight ) defaultField.isEditable = true defaultField.font = native.newFont( native.systemFontBold, inputFontSize ) defaultField:addEventListener( "userInput", fieldHandler( function() return defaultField end ) )

Have you tried this on a device yet?

Rob

Well, the event.phase works properly on an Android device, but not on the simulator.

anyway, the docs & sample code @ “api/library/native/newTextBox.html” needs to be updated, to include " .isEditable = true", as it is needed before it can be edited (the textField works fine).

Thx

Hi @yosu,

Thanks for the note. I’ll update the documentation soon with this bit.

Brent

Have you tried this on a device yet?

Rob

Well, the event.phase works properly on an Android device, but not on the simulator.

anyway, the docs & sample code @ “api/library/native/newTextBox.html” needs to be updated, to include " .isEditable = true", as it is needed before it can be edited (the textField works fine).

Thx

Hi @yosu,

Thanks for the note. I’ll update the documentation soon with this bit.

Brent