Hello,
If I input spaces only then click OK button, the text is trimed and “OK” is not displayed on the simulator, but on Android yes. Is there a workaroud?
local function trim(str)
return string.gsub(str,"^%s*(.-)%s*$","%1")
end
local function touchOK(evt)
if evt.phase=="ended" then
fld.text=trim(fld.text)
if fld.text~="" then
display.newText("OK!",400,750,"Verdana",80)
end
end
return true
end
fld=native.newTextField(400,150,770,100)
rec=display.newRect(400,600,100,100)
rec:addEventListener("touch",touchOK)