native.setKeybordFocus not work

Hello,

I have a form with native.newTextField, to tap the text box it goes up the keyboard, type in the required text and clicking submit it hides the keyboard, so far ok.

My second text box has an event that directs to another scene with a tableView, what happens: I click on my first text box, type in the text and NOT click on send, right clicked on the Second text box that draws tableView, but clicking it does not hide the keyboard, and it is above the tableView, by clicking submit it does nothing, follows the event that I use:

local botaoConta = function( event ) local ass = inputAss.text composer.setVariable( "ass", ass ) local obs = inputObs.text composer.setVariable( "obs", obs ) -- began and ended, event touch text box if ( "began" == event.phase or "ended" == event.phase) then --hide keyboard native.setKeyboardFocus( nil ); local close = "1" if (close == "1") then composer.gotoScene( "account") end end end

Thanks for listening

Very important detail:

Android works,

iOS does not !!!

Did you try this by only detecting the “began” or “ended” phase, instead of both?

Hi Alex,

Yes already tried, already put without picking up the event, that is to trigger the function he already should hide the keyboard:

local botaoConta = function( event ) native.setKeyboardFocus( nil ); local ass = inputAss.text composer.setVariable( "ass", ass ) local obs = inputObs.text composer.setVariable( "obs", obs ) composer.gotoScene( "account") end

Here some images illustrating the situation

Textbox 1

https://uploaddeimagens.com.br/imagens/form-png–2

On click textbox 2 -> tableView (keyboard view)

https://uploaddeimagens.com.br/imagens/keyboard_on-png

As it should be

https://uploaddeimagens.com.br/imagens/keyboard_off-png

I made the following changes:

As in iOS was not working the native.setKeyboardFocus (nil), I configured the KeyboardFocus for getting textbox 1: native.setKeyboardFocus (inputAss) and he hid the keyboard when loading the tableView.

That’s a Bug’s iOS?

The android then works Nil made the following configuration:

local botaoContaiOS = function( event ) local ass = inputAss.text composer.setVariable( "ass", ass ) local obs = inputObs.text composer.setVariable( "obs", obs ) if ( "began" == event.phase) then native.setKeyboardFocus( inputAss ); local close = "1" if (close == "1") then composer.gotoScene( "acount") end end end local botaoConta = function( event ) native.setKeyboardFocus( nil ); local assuntos = inputAssunto.text composer.setVariable( "assunto", assuntos ) local observacoes = inputObs.text composer.setVariable( "obs", observacoes ) composer.gotoScene( "conta") end if(system.getInfo("platformName") == "iPhone OS") then inputConta:addEventListener( "userInput", botaoContaiOS ); else inputConta:addEventListener( "userInput", botaoConta ); end

If you have any other suggestions, share.

Very important detail:

Android works,

iOS does not !!!

Did you try this by only detecting the “began” or “ended” phase, instead of both?

Hi Alex,

Yes already tried, already put without picking up the event, that is to trigger the function he already should hide the keyboard:

local botaoConta = function( event ) native.setKeyboardFocus( nil ); local ass = inputAss.text composer.setVariable( "ass", ass ) local obs = inputObs.text composer.setVariable( "obs", obs ) composer.gotoScene( "account") end

Here some images illustrating the situation

Textbox 1

https://uploaddeimagens.com.br/imagens/form-png–2

On click textbox 2 -> tableView (keyboard view)

https://uploaddeimagens.com.br/imagens/keyboard_on-png

As it should be

https://uploaddeimagens.com.br/imagens/keyboard_off-png

I made the following changes:

As in iOS was not working the native.setKeyboardFocus (nil), I configured the KeyboardFocus for getting textbox 1: native.setKeyboardFocus (inputAss) and he hid the keyboard when loading the tableView.

That’s a Bug’s iOS?

The android then works Nil made the following configuration:

local botaoContaiOS = function( event ) local ass = inputAss.text composer.setVariable( "ass", ass ) local obs = inputObs.text composer.setVariable( "obs", obs ) if ( "began" == event.phase) then native.setKeyboardFocus( inputAss ); local close = "1" if (close == "1") then composer.gotoScene( "acount") end end end local botaoConta = function( event ) native.setKeyboardFocus( nil ); local assuntos = inputAssunto.text composer.setVariable( "assunto", assuntos ) local observacoes = inputObs.text composer.setVariable( "obs", observacoes ) composer.gotoScene( "conta") end if(system.getInfo("platformName") == "iPhone OS") then inputConta:addEventListener( "userInput", botaoContaiOS ); else inputConta:addEventListener( "userInput", botaoConta ); end

If you have any other suggestions, share.