Button widget shows in corona simulator but not on actual device.

So I have a problem, I started my first app and got pretty far, I created a button widget which works and showed up in both the corona simulator and the blue stacks simulator. 

I added a text field and everything turned out fine in the corona simulator, but when it was time to test the text field in the bluestacks simulator as soon as I started the app, there was a text field but the button was gone, Im not sure why that is happening. 

Also while developing I have the corona simulator in galaxy s3 mode and it looks great, everything is as it should be, when I change the corona simulator to iphone or ipad, everything stays at it should but the button moves to the right. Im not sure why.

The code,

--Requires --widget = require ( "widget" ) local widget = require "widget-v1" --Set constant width and height of screen. \_W = display.viewableContentWidth \_H = display.viewableContentHeight --Create white background local background = display.newRect(0,0,\_W, \_H) background:setFillColor ( 70,130,180 ) --End Basic Stuff --Result Text dbText = ("db Loss") rText = display.newText (dbText,0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 -- Variables Needed local distanceData = 2 local connData = 5 local spliceData = 1 local distLoss = 3.5 local conLoss = .75 local spliceLoss = 0.3 --end variables --Field Texts Title Start local dlTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) dlTitle.x = \_W \* .5 dlTitle.y = \_H \* .05 local clTitle = display.newText( "Average Connector Loss", 0, 0, helvetica, 24 ) clTitle.x = \_W \* .5 clTitle.y = dlTitle.y +150 local slTitle = display.newText( "Average Splice Loss", 0, 0, helvetica, 24 ) slTitle.x = \_W \* .5 slTitle.y = clTitle.y +150 local dTitle = display.newText( "Cable Distance", 0, 0, helvetica, 24 ) dTitle.x = \_W \* .5 dTitle.y = slTitle.y + 150 local cTitle = display.newText( "Number of Connectors", 0, 0, helvetica, 24 ) cTitle.x = \_W \* .5 cTitle.y = dTitle.y+150 local sTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) sTitle.x = \_W \* .5 sTitle.y = cTitle.y + 150 --Field Title End --Fields Start local gotEnd = false local function getData(event) end distField = native.newTextField(\_W \* .23, dlTitle.y + 25, \_W - 300,50) distField:addEventListener ("userInput", getData) distField.font = "helvetica" distField.size = 24 distField:setTextColor(51,51,122,255) --Fields End --Main Function function resulter (d,c,s,dl,cl,sl) rText.text = "" local r d = d \* dl c = c \* cl s = s \* sl r = (d + c) + s print (r) local resultIs = r local dbText = ("db Loss: " .. resultIs) local rText = display.newText (dbText, 0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 end --Event Handlers local function btnOnPressHandler() resulter(distanceData, connData, spliceData, distLoss, conLoss, spliceLoss ) end local function btnOnReleaseHandler() print ("Released") end --endEvent Handlers local button = widget.newButton( { id= "button 1", left = 0, top = 0, label = "Calculate Loss", width = 256, height = 56, font = Helvetica, fontSize = 27, labelColor = { default={0,0,0}, over= {255,255,255} }, defaultColor={201,107,61}, overColor = {219,146,85}, onPress = btnOnPressHandler , onDrag = btnOnDragHandler, onRelease = btnOnReleaseHandler }) button.x = display.actualContentWidth /2 button.y = display.actualContentHeight \*.8 --resulter(distanceField, connField, spliceField, distLoss, conLoss, spliceLoss) print ("x position is " .. button.x) print ("y position is " .. button.y) print ("button x position is" .. background.x) print ("button y position is" .. background.y)

I was able to test on an actual device today. I tested on a HTC Thunderbolt.

Everything looks as it should but still not button.

Kinda strange that the button is where it should be when I test on the Corona Simulator but when I test on a device it does not show.

I’m stumped.

Are you getting an errors in your console log?

What is the Helvetica variable you are using as a font?  Should that be the string “Helvetica” or do you have a variable defined somewhere?

Have you make sure all file names match?  They are case sensitive on device, not sensitive in the simulator.

I dont see any errors in the console, everything seems to work as it should.

I dont have Helvetica as a variable, I was trying to set the font to Helvetica. Do I need quotes around helvetica if it is not a variable? 

Im not using any files, no images, no audio files all I have is the main.lua and the corona files, config.lua, build.lua.

Thats about it. 

Yes, you need “Helvetica” as a string, not a Variable.  If you have not defined it, you are passing nil for that parameter, but that shouldn’t crash anything, you would just get native.systemFont for the font.

You are using widget-v1.lua

You have to make sure that file exists in your main.lua folder and that it’s name matches.

I tried using helvetica as a string, and I got the same result, I also tried simply removing the font type and the size and still I got nothing.

I started commenting everything out and I found when I have the background and the button only as active code then when I test it shows both button and bg on a device, I also found if I have the button, br, and the labels for the text fields, this also works on a device. Its not until I create an actual field that the button goes away.

I did just make it work though, the way I did it was rather than having my field be created before the button, I had it be created below the block of code that creates the button and that seemed to work. 

Here is my code again, notice how the text field start is after the button code rather than before.

--Requires widget = require ( "widget" ) --local widget = require "widget-v1" --Set constant width and height of screen. \_W = display.viewableContentWidth \_H = display.viewableContentHeight --Create white background local background = display.newRect(0,0,\_W, \_H) background:setFillColor ( 70,130,180 ) --End Basic Stuff --Result Text dbText = ("db Loss") rText = display.newText (dbText,0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 -- Variables Needed local distanceData = 2 local connData = 5 local spliceData = 1 local distLoss = 3.5 local conLoss = .75 local spliceLoss = 0.3 local distField --end variables --Field Texts Title Start local dlTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) dlTitle.x = \_W \* .5 dlTitle.y = \_H \* .05 local clTitle = display.newText( "Average Connector Loss", 0, 0, helvetica, 24 ) clTitle.x = \_W \* .5 clTitle.y = dlTitle.y +150 local slTitle = display.newText( "Average Splice Loss", 0, 0, helvetica, 24 ) slTitle.x = \_W \* .5 slTitle.y = clTitle.y +150 local dTitle = display.newText( "Cable Distance", 0, 0, helvetica, 24 ) dTitle.x = \_W \* .5 dTitle.y = slTitle.y + 150 local cTitle = display.newText( "Number of Connectors", 0, 0, helvetica, 24 ) cTitle.x = \_W \* .5 cTitle.y = dTitle.y+150 local sTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) sTitle.x = \_W \* .5 sTitle.y = cTitle.y + 150 --Field Title End --Fields Start --[[local gotEnd = false local function getData(event) end distField = native.newTextField(\_W \* .23,20, \_W - 300,50) distField:addEventListener ("userInput", getData) distField.font = "native.systemFont" distField.size = 24 distField:setTextColor(51,51,122,255) --]] --Fields End --Main Function function resulter (d,c,s,dl,cl,sl) rText.text = "" local r d = d \* dl c = c \* cl s = s \* sl r = (d + c) + s print (r) local resultIs = r local dbText = ("db Loss: " .. resultIs) local rText = display.newText (dbText, 0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 end --Event Handlers local function btnOnPressHandler() resulter(distanceData, connData, spliceData, distLoss, conLoss, spliceLoss ) end local function btnOnReleaseHandler() print ("Released") end --endEvent Handlers local button = widget.newButton( { id= "button 1", left = 0, top = 0, label = "Calculate Loss", width = 256, height = 56, --font = "native.systemFont", --fontSize = 27, labelColor = { default={0,0,0}, over= {255,255,255} }, defaultColor={201,107,61}, overColor = {219,146,85}, onPress = btnOnPressHandler , onDrag = btnOnDragHandler, onRelease = btnOnReleaseHandler }) button.x = display.actualContentWidth /2 button.y = display.actualContentHeight \*.8 --resulter(distanceField, connField, spliceField, distLoss, conLoss, spliceLoss) --Fields Start local gotEnd = false local function getData(event) end distField = native.newTextField(\_W \* .23,20, \_W - 300,50) distField:addEventListener ("userInput", getData) distField.font = "native.systemFont" distField.size = 24 distField:setTextColor(51,51,122,255) --Fields End print ("x position is " .. button.x) print ("y position is " .. button.y) print ("button x position is" .. background.x) print ("button y position is" .. background.y)

Your new code has an error:

2013-07-10 23:56:15.029 Corona Simulator[988:707] Runtime error /Users/rmiracle/tmp/main.lua:137: bad argument #3 to '?' (native.Font expected, got string) stack traceback:     [C]: ?     [C]: ?     /Users/rmiracle/tmp/main.lua:137: in main chunk  

That line should be:

distField.font = native.newFont( native.systemFont, 24 )

The other references to helvetica need to be  the string “Helvetica”, if not it will default to native.systemFont which looks pretty close to Helvetica.

Ok, I changed it and I think its working now. 

I get the button and the textfield showing up and all works as it should.

Here is my new issue:

 button works now, it triggers my function and pretty much takes all the variables and does some math, then outputs the result at the bottom of the screen.

 

Till now the variables that the function uses to do the math where pre-defined, however now I have it to where I have two text fields, the first text field seems to work fine, it grabs the data from the field and assigns it to the distLoss. 

 

This seems to work ok, I added the second text field that is supposed to grab the user input data and put it in the conLoss variable, however looks like this is not working.

 

Also when hit then button the first time, the text displaying on the bottom of the screen goes away, and new text is displayed as it should, when I type in new number and try to generate a new result, the result shows but it shows on top of the data that is currently display.

 

Also I commented my code way better than before so, hope you have a better idea of what it is supposed to do.

--Requires widget = require ( "widget" ) --local widget = require "widget-v1" --Set constant width and height of screen. \_W = display.viewableContentWidth \_H = display.viewableContentHeight --Create white background local background = display.newRect(0,0,\_W, \_H) background:setFillColor ( 70,130,180 ) --End Basic Stuff --Result Text dbText = ("db Loss") rText = display.newText (dbText,0, 0,native.systemFont, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 -- Variables Needed -- These variables are used to store the ammount of items there are for connectors and splices, and the distance of the cable run in km local distanceData = 2 local connData = 5 local spliceData = 1 -- These variables are used to store the ammount of loss per item, if there are 2km of distanceData then each km would be worth 3.5, in the math function the math would be distanceData = distanceData \* distLoss local distLoss = 3.5 local conLoss = .75 local spliceLoss = 0.3 -- Field variables local distField --end variables --Field Texts Titles -- Data local dlTitle = display.newText( "Average Distance Loss Per Km", 0, 0, helvetica, 24 ) dlTitle.x = \_W \* .5 dlTitle.y = \_H \* .05 local clTitle = display.newText( "Average Connector Loss", 0, 0, helvetica, 24 ) clTitle.x = \_W \* .5 clTitle.y = dlTitle.y +150 local slTitle = display.newText( "Average Splice Loss", 0, 0, helvetica, 24 ) slTitle.x = \_W \* .5 slTitle.y = clTitle.y +150 local dTitle = display.newText( "Cable Distance", 0, 0, helvetica, 24 ) dTitle.x = \_W \* .5 dTitle.y = slTitle.y + 150 local cTitle = display.newText( "Number of Connectors", 0, 0, helvetica, 24 ) cTitle.x = \_W \* .5 cTitle.y = dTitle.y+150 local sTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) sTitle.x = \_W \* .5 sTitle.y = cTitle.y + 150 --Math Function function resulter (d,c,s,dl,cl,sl) rText.text = "" local r d = d \* dl c = c \* cl s = s \* sl r = (d + c) + s print (r) local resultIs = r local dbText = ("db Loss: " .. resultIs) local rText = display.newText (dbText, 0, 0, native.systemFont, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 end --Button Handler local function btnOnPressHandler() resulter(distanceData, connData, spliceData, distLoss, conLoss, spliceLoss ) end local function btnOnReleaseHandler() print ("Released") end --Create button local button1 = widget.newButton( { id= "button 1", left = 0, top = 0, label = "Calculate Loss", width = 256, height = 56, --font = "native.systemFont", --fontSize = 27, labelColor = { default={0,0,0}, over= {255,255,255} }, defaultColor={201,107,61}, overColor = {219,146,85}, onPress = btnOnPressHandler , onDrag = btnOnDragHandler, onRelease = btnOnReleaseHandler }) button1.x = display.actualContentWidth \* .5 button1.y = display.actualContentHeight \*.8 -- Field Start --1 distField = native.newTextField(\_W \* .23,dlTitle.y +30, \_W - 300,50) distField.inputType = "default" distField.size = 24 distField.align = "center" --2 aConLoss = native.newTextField(\_W \* .23,clTitle.y +30, \_W - 300,50) aConLoss.inputType = "default" aConLoss.size = 24 aConLoss.align = "center" --Fields End --hide keyaboard function background:tap (e) native.setKeyboardFocus(nil) print ("distLoss" .. distLoss) end -- Text Field Functions --Field 1 function distField:userInput(e) if(e.phase == "began") then elseif (e.phase == "editing") then dbText.text = nil elseif (e.phase == "ended") then dbText = "" distLoss = e.target.text elseif(e.phase == "submitted") then dbText.text="" distLoss = e.target.text end end --Field 2 function aConLoss:userInput(n) if(n.phase == "began") then elseif (n.phase == "editing") then dbText.text = nil elseif (n.phase == "ended") then dbText.text = "" conLoss = n.target.text elseif(e.phase == "submitted") then dbText.text="" conLoss = n.target.text end end --Text field listeners background:addEventListener("tap", background) distField:addEventListener("userInput", distField ) aConLoss:addEventListener("userInput", aConLoss ) print ("distLoss" .. distLoss) print ("rText is" .. rText.text)

I was able to test on an actual device today. I tested on a HTC Thunderbolt.

Everything looks as it should but still not button.

Kinda strange that the button is where it should be when I test on the Corona Simulator but when I test on a device it does not show.

I’m stumped.

Are you getting an errors in your console log?

What is the Helvetica variable you are using as a font?  Should that be the string “Helvetica” or do you have a variable defined somewhere?

Have you make sure all file names match?  They are case sensitive on device, not sensitive in the simulator.

I dont see any errors in the console, everything seems to work as it should.

I dont have Helvetica as a variable, I was trying to set the font to Helvetica. Do I need quotes around helvetica if it is not a variable? 

Im not using any files, no images, no audio files all I have is the main.lua and the corona files, config.lua, build.lua.

Thats about it. 

Yes, you need “Helvetica” as a string, not a Variable.  If you have not defined it, you are passing nil for that parameter, but that shouldn’t crash anything, you would just get native.systemFont for the font.

You are using widget-v1.lua

You have to make sure that file exists in your main.lua folder and that it’s name matches.

I tried using helvetica as a string, and I got the same result, I also tried simply removing the font type and the size and still I got nothing.

I started commenting everything out and I found when I have the background and the button only as active code then when I test it shows both button and bg on a device, I also found if I have the button, br, and the labels for the text fields, this also works on a device. Its not until I create an actual field that the button goes away.

I did just make it work though, the way I did it was rather than having my field be created before the button, I had it be created below the block of code that creates the button and that seemed to work. 

Here is my code again, notice how the text field start is after the button code rather than before.

--Requires widget = require ( "widget" ) --local widget = require "widget-v1" --Set constant width and height of screen. \_W = display.viewableContentWidth \_H = display.viewableContentHeight --Create white background local background = display.newRect(0,0,\_W, \_H) background:setFillColor ( 70,130,180 ) --End Basic Stuff --Result Text dbText = ("db Loss") rText = display.newText (dbText,0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 -- Variables Needed local distanceData = 2 local connData = 5 local spliceData = 1 local distLoss = 3.5 local conLoss = .75 local spliceLoss = 0.3 local distField --end variables --Field Texts Title Start local dlTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) dlTitle.x = \_W \* .5 dlTitle.y = \_H \* .05 local clTitle = display.newText( "Average Connector Loss", 0, 0, helvetica, 24 ) clTitle.x = \_W \* .5 clTitle.y = dlTitle.y +150 local slTitle = display.newText( "Average Splice Loss", 0, 0, helvetica, 24 ) slTitle.x = \_W \* .5 slTitle.y = clTitle.y +150 local dTitle = display.newText( "Cable Distance", 0, 0, helvetica, 24 ) dTitle.x = \_W \* .5 dTitle.y = slTitle.y + 150 local cTitle = display.newText( "Number of Connectors", 0, 0, helvetica, 24 ) cTitle.x = \_W \* .5 cTitle.y = dTitle.y+150 local sTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) sTitle.x = \_W \* .5 sTitle.y = cTitle.y + 150 --Field Title End --Fields Start --[[local gotEnd = false local function getData(event) end distField = native.newTextField(\_W \* .23,20, \_W - 300,50) distField:addEventListener ("userInput", getData) distField.font = "native.systemFont" distField.size = 24 distField:setTextColor(51,51,122,255) --]] --Fields End --Main Function function resulter (d,c,s,dl,cl,sl) rText.text = "" local r d = d \* dl c = c \* cl s = s \* sl r = (d + c) + s print (r) local resultIs = r local dbText = ("db Loss: " .. resultIs) local rText = display.newText (dbText, 0, 0, helvetica, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 end --Event Handlers local function btnOnPressHandler() resulter(distanceData, connData, spliceData, distLoss, conLoss, spliceLoss ) end local function btnOnReleaseHandler() print ("Released") end --endEvent Handlers local button = widget.newButton( { id= "button 1", left = 0, top = 0, label = "Calculate Loss", width = 256, height = 56, --font = "native.systemFont", --fontSize = 27, labelColor = { default={0,0,0}, over= {255,255,255} }, defaultColor={201,107,61}, overColor = {219,146,85}, onPress = btnOnPressHandler , onDrag = btnOnDragHandler, onRelease = btnOnReleaseHandler }) button.x = display.actualContentWidth /2 button.y = display.actualContentHeight \*.8 --resulter(distanceField, connField, spliceField, distLoss, conLoss, spliceLoss) --Fields Start local gotEnd = false local function getData(event) end distField = native.newTextField(\_W \* .23,20, \_W - 300,50) distField:addEventListener ("userInput", getData) distField.font = "native.systemFont" distField.size = 24 distField:setTextColor(51,51,122,255) --Fields End print ("x position is " .. button.x) print ("y position is " .. button.y) print ("button x position is" .. background.x) print ("button y position is" .. background.y)

Your new code has an error:

2013-07-10 23:56:15.029 Corona Simulator[988:707] Runtime error /Users/rmiracle/tmp/main.lua:137: bad argument #3 to '?' (native.Font expected, got string) stack traceback:     [C]: ?     [C]: ?     /Users/rmiracle/tmp/main.lua:137: in main chunk  

That line should be:

distField.font = native.newFont( native.systemFont, 24 )

The other references to helvetica need to be  the string “Helvetica”, if not it will default to native.systemFont which looks pretty close to Helvetica.

Ok, I changed it and I think its working now. 

I get the button and the textfield showing up and all works as it should.

Here is my new issue:

 button works now, it triggers my function and pretty much takes all the variables and does some math, then outputs the result at the bottom of the screen.

 

Till now the variables that the function uses to do the math where pre-defined, however now I have it to where I have two text fields, the first text field seems to work fine, it grabs the data from the field and assigns it to the distLoss. 

 

This seems to work ok, I added the second text field that is supposed to grab the user input data and put it in the conLoss variable, however looks like this is not working.

 

Also when hit then button the first time, the text displaying on the bottom of the screen goes away, and new text is displayed as it should, when I type in new number and try to generate a new result, the result shows but it shows on top of the data that is currently display.

 

Also I commented my code way better than before so, hope you have a better idea of what it is supposed to do.

--Requires widget = require ( "widget" ) --local widget = require "widget-v1" --Set constant width and height of screen. \_W = display.viewableContentWidth \_H = display.viewableContentHeight --Create white background local background = display.newRect(0,0,\_W, \_H) background:setFillColor ( 70,130,180 ) --End Basic Stuff --Result Text dbText = ("db Loss") rText = display.newText (dbText,0, 0,native.systemFont, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 -- Variables Needed -- These variables are used to store the ammount of items there are for connectors and splices, and the distance of the cable run in km local distanceData = 2 local connData = 5 local spliceData = 1 -- These variables are used to store the ammount of loss per item, if there are 2km of distanceData then each km would be worth 3.5, in the math function the math would be distanceData = distanceData \* distLoss local distLoss = 3.5 local conLoss = .75 local spliceLoss = 0.3 -- Field variables local distField --end variables --Field Texts Titles -- Data local dlTitle = display.newText( "Average Distance Loss Per Km", 0, 0, helvetica, 24 ) dlTitle.x = \_W \* .5 dlTitle.y = \_H \* .05 local clTitle = display.newText( "Average Connector Loss", 0, 0, helvetica, 24 ) clTitle.x = \_W \* .5 clTitle.y = dlTitle.y +150 local slTitle = display.newText( "Average Splice Loss", 0, 0, helvetica, 24 ) slTitle.x = \_W \* .5 slTitle.y = clTitle.y +150 local dTitle = display.newText( "Cable Distance", 0, 0, helvetica, 24 ) dTitle.x = \_W \* .5 dTitle.y = slTitle.y + 150 local cTitle = display.newText( "Number of Connectors", 0, 0, helvetica, 24 ) cTitle.x = \_W \* .5 cTitle.y = dTitle.y+150 local sTitle = display.newText( "Average Distance Loss", 0, 0, helvetica, 24 ) sTitle.x = \_W \* .5 sTitle.y = cTitle.y + 150 --Math Function function resulter (d,c,s,dl,cl,sl) rText.text = "" local r d = d \* dl c = c \* cl s = s \* sl r = (d + c) + s print (r) local resultIs = r local dbText = ("db Loss: " .. resultIs) local rText = display.newText (dbText, 0, 0, native.systemFont, 42) rText:setTextColor(255,255,255) rText.x = \_W \* .5 rText.y = \_H -100 end --Button Handler local function btnOnPressHandler() resulter(distanceData, connData, spliceData, distLoss, conLoss, spliceLoss ) end local function btnOnReleaseHandler() print ("Released") end --Create button local button1 = widget.newButton( { id= "button 1", left = 0, top = 0, label = "Calculate Loss", width = 256, height = 56, --font = "native.systemFont", --fontSize = 27, labelColor = { default={0,0,0}, over= {255,255,255} }, defaultColor={201,107,61}, overColor = {219,146,85}, onPress = btnOnPressHandler , onDrag = btnOnDragHandler, onRelease = btnOnReleaseHandler }) button1.x = display.actualContentWidth \* .5 button1.y = display.actualContentHeight \*.8 -- Field Start --1 distField = native.newTextField(\_W \* .23,dlTitle.y +30, \_W - 300,50) distField.inputType = "default" distField.size = 24 distField.align = "center" --2 aConLoss = native.newTextField(\_W \* .23,clTitle.y +30, \_W - 300,50) aConLoss.inputType = "default" aConLoss.size = 24 aConLoss.align = "center" --Fields End --hide keyaboard function background:tap (e) native.setKeyboardFocus(nil) print ("distLoss" .. distLoss) end -- Text Field Functions --Field 1 function distField:userInput(e) if(e.phase == "began") then elseif (e.phase == "editing") then dbText.text = nil elseif (e.phase == "ended") then dbText = "" distLoss = e.target.text elseif(e.phase == "submitted") then dbText.text="" distLoss = e.target.text end end --Field 2 function aConLoss:userInput(n) if(n.phase == "began") then elseif (n.phase == "editing") then dbText.text = nil elseif (n.phase == "ended") then dbText.text = "" conLoss = n.target.text elseif(e.phase == "submitted") then dbText.text="" conLoss = n.target.text end end --Text field listeners background:addEventListener("tap", background) distField:addEventListener("userInput", distField ) aConLoss:addEventListener("userInput", aConLoss ) print ("distLoss" .. distLoss) print ("rText is" .. rText.text)