Hey,
I’m completely new to Corona and have a very newbie question. I’m sure some people will cringe at this question and my spaghetti code.
I need any value I enter in a text box on screen to be printed on the screen (not in the console) and it needs to be updated real time. For example, if I enter “hello” in the text box, after I press enter it is printed at the top of the screen.
local defaultField
local string
local function textListener( event )
if ( event.phase == “ended” or event.phase == “submitted” ) then
– Output resulting text from “defaultField”
string = event.target.text
print( string )
end
end
– Create text field
defaultField = native.newTextField( 365, 400, 180, 30 )
defaultField:addEventListener( “userInput”, textListener )
local options = {
text = “”… tostring(string) … " " … tostring(string) … " ", --Display anything entered into textbox
x = 365,
y = 100,
width = 250,
font = native.systemFontBold,
fontSize = 24,
align = “center”
}
local text1 = display.newText(options)