hello all,
I’m using native.newTextField at the bottom of the screen to let the user enter his/her name and save it to a score file. When the field is clicked I move the field to the top so it sits above the virtual keyboard of a phone/tablet.
Now when the field is clicked the event.phase is ‘begin’ . when a name is typed in the event.phase is ‘edifting’ (for each character.
if the user hits <Enter> it then goes to a phase of ‘submitted’ (sometimes ‘ended’) which allows me to move the field back to the bottom of the screen.
However if the user simply clicks out of the native.newTextField it doesnt go into a phase of ‘ended’ or ‘submitted’
Even if I click on another button, the field is still up there awaiting a <Enter>.
Is there a proper way for the phase to go to ‘ended’ when clicking out of it ?
I can move the field back down in all other button/pictures/icon EventListeners but it’s pretty tedious !
thanks !
12:04:55.994 here is lncurrentUserField> fr <> fr <> began
12:04:57.518 here is lncurrentUserField> fre <> fr <> editing
12:04:57.667 here is lncurrentUserField> fred <> fr <> editing
12:05:05.317 here is lncurrentUserField> fred <> fr <> submitted --<< only when hit <Enter>
function lncurrentUserField(event) print ("here is lncurrentUserField\>",currentUserField.text,"\<\>",glob.currentUserSaved,"\<\>",event.phase) if ( event.phase == "began" and string.upper(currentUserField.text) == "ENTER YOUR NAME") then currentUserField.text = "" currentUserField.y = screenCenY - 50 elseif ( event.phase == "began" and string.upper(currentUserField.text) ~= "ENTER YOUR NAME" ) then currentUserField.y = screenCenY - 50 elseif ( event.phase == "ended" or event.phase == "submitted" ) then --\<\< it comes here if hit \<Enter\> fnmoveCurrentUserFieldDown() -- but not if click outside end end currentUserField = native.newTextField( screenCenX , screenBot -20 , 200, 20 ) currentUserField:addEventListener( "userInput", lncurrentUserField )