I think I have discovered why this “white hole” remained on the screen. telField.hasBackground = false seems to fix this. But I still have an issue…
Everything runs smoothly when tapping the screen, entering the new telephone number and then, after digit 8, the text “Lagrer…” (“Storing…”) appears and next the “ID: XXXXXXXX”. But now, if I tap again, the execution starts directly in textListener, instead of in handleIDButtonEvent.
I have tried telField.removeEventListener( “userInput”, textListener ) at the end of textListener, but with no success.
local function textListener( event ) if ( event.phase == "editing" ) then if ( string.len(event.target.text) == 8 ) then telno = event.target.text -- Write the telephone number to file local path = system.pathForFile( "georeg.txt", system.DocumentsDirectory ) local file, errorString = io.open( path, "w" ) if not file then -- Error occurred; output the cause print( "File error: " .. errorString ) else file:write( telno ) io.close( file ) end file = nil telField:removeEventListener( "userInput", textListener ) display.remove(telField) telField = nil native.setKeyboardFocus( nil ) IDText.text = "Lagrer..." timer.performWithDelay( 1000, IDShow, 1 ) end end end local function handleIDButtonEvent(event) -- Create text field system.vibrate() telField = native.newTextField( display.contentCenterX, display.contentCenterY \* 0.1, 100, 30 ) telField.hasBackground = false telField:addEventListener( "userInput", textListener ) telField.inputType = "phone" telField.align = "center" telField.font = native.newFont( native.systemFont, 16 ) telField:resizeHeightToFitFont() telField:setTextColor( 1, 1, 1 ) native.setKeyboardFocus(telField) IDText.text = "" end -- Function to handle timer event function IDShow(event) IDText.text = "ID: " .. telno end