I am using a textfield in my project i want to set the limit of the number of characters that can be entered in the textfield. i’m unable to do that. can anybody tell me how can i do that?? Secondly, when i click the textbox i want the old text to be removed. how can i do that? i’m posting the code.
[lua]
local function onTitle( event )
– Hide keyboard when the user clicks “Return” in this field
if ( “ended” == event.phase or “submitted” == event.phase ) then
titletext = event.target.text
print(titletext)
native.setKeyboardFocus( nil )
end
end
title = native.newTextField( display.contentWidth*0.04, display.contentHeight-(display.contentHeight*0.90), 350, 50,
onTitle )
–title.x = title.width * 0.5
title.text = “Enter Title”
title.isEditable = true
group:insert(title)
[/lua]