How to Autocomplete TextBox ?

Hello,

Is there anyway to get the textfield Autocomplete ?
So for example I want insert a first letter of a word in the textbox and then it will display the words beginning with that letter using a word list previously charged. (not too slow)

Best regards, :slight_smile:

Nassim

Hello and Welcome to the forums! 

Now. Do you have any code for us to start a base on?

–SonicX278

local tbDrink = native.newTextBox( centerX, centerY, 100, 25 ) tbDrink.text = "" tbDrink.isEditable = true tbDrink:addEventListener( "userInput", inputListener )

local function inputListener( event ) if event.phase == "began" then print( event.text ) elseif event.phase == "ended" then elseif event.phase == "editing" then print( event.newCharacters ) print( event.oldText ) end end

local dataOfMyList = { "Hot Coffee", "Iced Coffee", "Espresso", "Cappuccino", "Latte", "Americano" }

For example, if I put the letter “A” in the textBox , the word " Americano " will be displayed below allowing the user to selecte this word
 

Hello,

Can you help me for that ?

I won’t be home for a couple hours and then I have to get ready for a vacation that I’m going to tomorrow. So I can’t help right now. Maybe someone in the community will pitch in.

–SonicX278

This thread talks a bit about utilizing a search box, which can perform the same function. Essentially, you would most likely want to listen to the event.text userInput and update your object’s text values accordingly.

Hello and Welcome to the forums! 

Now. Do you have any code for us to start a base on?

–SonicX278

local tbDrink = native.newTextBox( centerX, centerY, 100, 25 ) tbDrink.text = "" tbDrink.isEditable = true tbDrink:addEventListener( "userInput", inputListener )

local function inputListener( event ) if event.phase == "began" then print( event.text ) elseif event.phase == "ended" then elseif event.phase == "editing" then print( event.newCharacters ) print( event.oldText ) end end

local dataOfMyList = { "Hot Coffee", "Iced Coffee", "Espresso", "Cappuccino", "Latte", "Americano" }

For example, if I put the letter “A” in the textBox , the word " Americano " will be displayed below allowing the user to selecte this word
 

Hello,

Can you help me for that ?

I won’t be home for a couple hours and then I have to get ready for a vacation that I’m going to tomorrow. So I can’t help right now. Maybe someone in the community will pitch in.

–SonicX278

This thread talks a bit about utilizing a search box, which can perform the same function. Essentially, you would most likely want to listen to the event.text userInput and update your object’s text values accordingly.