First time corona user intro, and a few questions.

So I’m a first time Corona user, I am not new to programming though I have worked with C++, Python, PHP, and Java to new a few languages. 

I am new to Corona though, I have tried looking at a few tutorials and bought a video course from infinite skills, however the course was not made for the style of learning I have.

I decided the best way I have learned other languages and libraries is to just jump right into a project.

For my first project I am working on a app the takes a user input number from a text field then multiplies that number with a set number. The user is asked to do this 3 times and then the app adds all three numbers together and then outputs the value. Its something I need for work (telecommunications engineering) so this is really to benefit me. I already have the logic and I tested the logic in Python prior to even thinking about porting it to Corona.

-So far the problem I run into is I cant get the native.textField to show up on the emulator.

I do get an error on the corona console: “Warning : native text fields are not currently supported in the simulator”

And I understand what that means. I have however done this during a tutorial and although the text field did not look like it would on an actual device, I could see a text field.

Any help is appreciated.

Here is my code so far for the single text field.

\_W = display.viewableContentWidth \_H = display.viewableContentHeight local background = display.newRect(0, 0, \_W, \_H) background:setFillColor ( 255,255,255 ) local distance = native.newTextField ( 0, 0, \_W\*.8, 48 ) distance.inputType = "default" distance.x = \_W \*5 distance.y = 100 local font = "HelveticaNeue" or system.nativeFont distance.font = native.newFont (font, 24 ) local hintText = "Cable Length" distance.text = hintText

I added this line to the end of your listing:

print(distance.x,distance.y,distance.width,distance.height)

The values it printed in the console are:

3840    100    614.40002441406    48

Which are way off screen.

Wow that is way off. What would cause that?

distance.x = \_W \*5

Maybe that should be:

distance.x = \_W \* .5

Wow I can’t believe I wrote 5 instead of .5 that is what I intended to write. Thank you for catching that.

I set my background to the viewable contend w and h.

If I test on android or anything that isn’t 320 c 480 it does not show right. Is there a way to have my background rect object take up the whole display space regardless of the resolution?

Have you tried display.actualNNN ?

http://docs.coronalabs.com/daily/api/library/display/index.html

I did not find that in the docs but is that like using:

display.actualContendWidth
display.actualContentHeight

There is no description on these two functions but by the name it sounds like I can set a rect object to the w or h of the actual device res regardless of the device?

http://docs.coronalabs.com/daily/api/library/display/actualContentHeight.html

http://docs.coronalabs.com/daily/api/library/display/actualContentWidth.html

Thank you, 

I did set it to display.actualContentW and H. Looks like with every model that I use in the simulator the width takes up all space but the height fills up most of the screen it goes all the way to the bottom but it does not quite make it all the way to the top of the screen.

I am also trying to figure out how to create text within the text field to give the user a hint on what to write in the field.

Here is what my code looks like.

--Set constant width and height of screen. \_W = display.actualContentWidth \_H = display.actualContentHeight --Create white background local background = display.newRect(0, 0, \_W, \_H) background:setFillColor ( 255,255,255 ) --Create text field for user to input distance local distance = native.newTextField ( 0, 0, \_W\*.8, 40) --text field keyboard type distance.inputType = "number" --Position text field distance.x = \_W /2 distance.y = 70 --Type of font to be used and size of font local font = "HelveticaNeue" or system.nativeFont distance.font = native.newFont (font, 24 ) --Hint text for the user to know what to write into the text field. local disHint = "Cable Length" disHint:setTextColor ( 0, 0, 0) distance.text = disHint

I added this line to the end of your listing:

print(distance.x,distance.y,distance.width,distance.height)

The values it printed in the console are:

3840    100    614.40002441406    48

Which are way off screen.

Wow that is way off. What would cause that?

distance.x = \_W \*5

Maybe that should be:

distance.x = \_W \* .5

Wow I can’t believe I wrote 5 instead of .5 that is what I intended to write. Thank you for catching that.

I set my background to the viewable contend w and h.

If I test on android or anything that isn’t 320 c 480 it does not show right. Is there a way to have my background rect object take up the whole display space regardless of the resolution?

Have you tried display.actualNNN ?

http://docs.coronalabs.com/daily/api/library/display/index.html

I did not find that in the docs but is that like using:

display.actualContendWidth
display.actualContentHeight

There is no description on these two functions but by the name it sounds like I can set a rect object to the w or h of the actual device res regardless of the device?

http://docs.coronalabs.com/daily/api/library/display/actualContentHeight.html

http://docs.coronalabs.com/daily/api/library/display/actualContentWidth.html

Thank you, 

I did set it to display.actualContentW and H. Looks like with every model that I use in the simulator the width takes up all space but the height fills up most of the screen it goes all the way to the bottom but it does not quite make it all the way to the top of the screen.

I am also trying to figure out how to create text within the text field to give the user a hint on what to write in the field.

Here is what my code looks like.

--Set constant width and height of screen. \_W = display.actualContentWidth \_H = display.actualContentHeight --Create white background local background = display.newRect(0, 0, \_W, \_H) background:setFillColor ( 255,255,255 ) --Create text field for user to input distance local distance = native.newTextField ( 0, 0, \_W\*.8, 40) --text field keyboard type distance.inputType = "number" --Position text field distance.x = \_W /2 distance.y = 70 --Type of font to be used and size of font local font = "HelveticaNeue" or system.nativeFont distance.font = native.newFont (font, 24 ) --Hint text for the user to know what to write into the text field. local disHint = "Cable Length" disHint:setTextColor ( 0, 0, 0) distance.text = disHint