xcode simulator is not able to generate the "began" phase when I click on the TextField

I have the following code, when I run them on Windows simulator, when I click on the textField: textInputKtoP, the “began” phase generated, it prints out “phase KtoP began:”. But when I ran the code on Mac, the “began” phase was not generated when I click on the text field. Until I started typing, then the “began” phase and “editing” phase both come in one after another without any delay.

Do you know if this is a bug on the Mac corona simulator?

Thanks

Ken

local textInputKtoP

local defaultValue =  “Insert value”

local function textInputKtoPInputListener( event )

    if event.phase == “began” then

        – user begins editing textBox

        – Check the text value here. If it is same as defaultValue, clean up the text, so that user doesn’t need to

        – clean up by them self

        print( “phase KtoP began:” … tostring(event.text) )

        print( "phase KtoP began: event.target.text hello – " … tostring(event.target.text) )

        if (event.target.text == defaultValue) then

            textInputKtoP.text = “”  – Clean up the text input box for user

        end

    elseif event.phase == “ended” then

        --[[users finished, reset it to the previous value]]

        if event.target.text == “” then

          textInputKtoP.text = defaultValue

          textOutputKtoP.text = defaultLabel

        end

    elseif event.phase == “editing” then

        – do something with textBox text

        print ("phase KtoP ended input is: " … event.target.text)

        local variable = tonumber(event.target.text)

        if variable ~= nil then

          print ("variable converted is: " … tostring(variable * 2.2046) … "before update: " … textOutputKtoP.text)

          textOutputKtoP.text = tostring(variable * 2.2046)

        else

          textOutputKtoP.text = “Please enter a numerical value”        

        end

    end

end

textInputKtoP = native.newTextBox( 320, 410, 400, 50 )

textInputKtoP.text = defaultValue

textInputKtoP.isEditable = true

textInputKtoP:addEventListener( “userInput”, textInputKtoPInputListener )

Hei kenhan,

I did not have a look at your code, but I can confirm that in my code there is no began phase as well. Besides, the event.oldText is always nil on the mac corona simulator.

(It is working on windows simulator, android, and ipad.)

The corona devs know about this?

Best,

Felix

Hei kenhan,

I did not have a look at your code, but I can confirm that in my code there is no began phase as well. Besides, the event.oldText is always nil on the mac corona simulator.

(It is working on windows simulator, android, and ipad.)

The corona devs know about this?

Best,

Felix