I’m making a game where you have to type stuff into a chatbox and wait for a response, but I want to have it so that when the user hits “enter” (or “done” on the nook) the keyboard doesn’t disappear. Pretty much I need the keyboard to be constantly visible. By default, if a user taps on a textField the keyboard shows up and then when they hit enter, it goes away. I put this line of code after I create the textBox:
native.setKeyboardFocus(chatbox)
but that just does makes the keyboard display once and then once the user hits “enter” the keyboard goes away. I also tried making it so that whenever the chatbox event is “submitted” or “ended” it sets the keyboard focus, but that didn’t work. Here’s what my code is currently, any help would be appreciated!
[code]
chatbox = native.newTextField( 124, 910, display.contentWidth - 150, 90, function(event)
– Only send when the user is ready.
if not (event.phase == “ended” or event.phase == “submitted”) then
native.setKeyboardFocus(chatbox)
print(“hi”)
end
if event.phase == “editing” then
print(“hi”)
end
– Don’t send Empyt Message
if chatbox.text == ‘’ then return end
text = username…": "…chatbox.text
send_a_message(tostring(text))
chatbox.text = ‘’
–native.setKeyboardFocus(nil)
end )
[/code] [import]uid: 14461 topic_id: 32722 reply_id: 332722[/import]