native.newTextField obscured elements in the foreground

Hello! I need your help again… 

  1. In my app, I use a native.newTextField to collect user information (user input) but the Text-Field keeps obscuring the user interface ( screenshots ) 

2.  mnTextInputCar:resizeFontToFitHeight  is working in the simulator but it isn’t working on an Android device? 

Code: 

Text-Field

local mnTextInputCar = native.newTextField( display.contentCenterX + 5, lblCar.y, 150, display.contentWidth / 25 )

mnTextInputCar.inputType = “default”

mnTextInputCar:setReturnKey( “done” )

grpUI:insert(mnTextInputCar)

mnTextInputCar.anchorX = 0

mnTextInputCar:resizeFontToFitHeight()

Ui


– grpMeasurement


local rectMenuTouchPreventerCarInfo = display.newRect( grpMeasurement, display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight )

rectMenuTouchPreventerCarInfo:setFillColor( 0, 0, 0, 0.6)

rectMenuTouchPreventerCarInfo.isHitTestable = true – Only needed if alpha is 0

rectMenuTouchPreventerCarInfo:addEventListener( “tap”, function() return true end)

rectMenuTouchPreventerCarInfo:addEventListener( “touch”, function() return true end)

local rectCarInfoInput = display.newRoundedRect( grpMeasurement, display.contentCenterX, display.contentCenterY, display.contentHeight / 2, display.contentHeight / 2, 25 )

local lblAutomodellInput = display.newText( grpMeasurement, “Automodell”, rectCarInfoInput.x, rectCarInfoInput.y, native.systemFontBold, display.contentWidth / 25 )

lblAutomodellInput:setFillColor( 0, 0, 0, 0.6 )

local sheetOptions =

{

width = 384,

height = 384,

numFrames = 6,

sheetContentWidth = 2304, --width of original 1x size of entire sheet

sheetContentHeight = 384

}

local sheetCountdown = graphics.newImageSheet( “img/countdown.png”, sheetOptions )

– sequences table

local sequencesCountdown = {

– consecutive frames sequence

{

name = “Countdown”,

start = 1,

count = 6,

time = 6000,

loopCount = 0,

loopDirection = “forward”

}

}

local animationCountdown = display.newSprite( sheetCountdown, sequencesCountdown )

animationCountdown.x = display.contentCenterX

animationCountdown.y = display.contentCenterY

grpMeasurement:insert(animationCountdown)

grpMeasurement.alpha = 0

– end of grpMeasurement

Groups

sceneGroup:insert(grpBackground)

sceneGroup:insert(grpUI)

sceneGroup:insert(grpMeasurement)

I know its is a big question but I hope somebody can answer them :D 

Thanks for helping me out again!! 

Hi, not reading your code but this is a native object and it will always be on top when visible.

Many, me included, have solved this by keeping the native boxes off screen, mirroring the input in a normal display.newText object, with which you can do more or less what you want.

Its easier than it sounds

Hello!  Thanks for answering my question and for the tip…  I think I got it! 

Happy to help when i can  :slight_smile:

Kepp keyboard focus on the native input box, control mirror objects text parameter using the native input fields event “editing”, and it will look pretty sweet, with any font you prefer.

I think I will solve this problem a bit different! On the first screen shot, you can see that there is a button with the label “Bestätigen” = “Submit”. So I will collect the data from the user and after the input, the user has to press the submit button. After pressing the button the native input box will be replaced with a label… next to the label will be a small “Edit” button. 

If you want to I can Update you with some screen shots  :D 

Do you know a solution to my second question ( the blue one ) 

Ps: sorry for my English but I am from Austria…  

I’ve never used textField since it is easy to make display.newText multiline using “\n” in the string.

Hence I don’t know the method you are calling.

But, since all text is an image (openGL) and if size is not known in advance when creating the text (image), I sometimes create it, then store the values I need, then remove it and create it again with the stored values, if that makes any sense.

But there always is more than one way to Rome

Btw, I was living in Vienna 4 years so i understand austrian and german, although a bit rusty when it comes to speaking :slight_smile:

Ops! sorry i didnt realize the textField is a native object.

I cant help you there then, sorry.

Maybe it would be possible to mirror it as well? :slight_smile:

Dann kann ich ja auch auf deutsch mit dir schreiben?!  :smiley:

Yeah that works just as well though I dont really have the answer to your resize issue :slight_smile:

Ah ok, now I get it… thanks! 

Hi, not reading your code but this is a native object and it will always be on top when visible.

Many, me included, have solved this by keeping the native boxes off screen, mirroring the input in a normal display.newText object, with which you can do more or less what you want.

Its easier than it sounds

Hello!  Thanks for answering my question and for the tip…  I think I got it! 

Happy to help when i can  :slight_smile:

Kepp keyboard focus on the native input box, control mirror objects text parameter using the native input fields event “editing”, and it will look pretty sweet, with any font you prefer.

I think I will solve this problem a bit different! On the first screen shot, you can see that there is a button with the label “Bestätigen” = “Submit”. So I will collect the data from the user and after the input, the user has to press the submit button. After pressing the button the native input box will be replaced with a label… next to the label will be a small “Edit” button. 

If you want to I can Update you with some screen shots  :D 

Do you know a solution to my second question ( the blue one ) 

Ps: sorry for my English but I am from Austria…  

I’ve never used textField since it is easy to make display.newText multiline using “\n” in the string.

Hence I don’t know the method you are calling.

But, since all text is an image (openGL) and if size is not known in advance when creating the text (image), I sometimes create it, then store the values I need, then remove it and create it again with the stored values, if that makes any sense.

But there always is more than one way to Rome

Btw, I was living in Vienna 4 years so i understand austrian and german, although a bit rusty when it comes to speaking :slight_smile:

Ops! sorry i didnt realize the textField is a native object.

I cant help you there then, sorry.

Maybe it would be possible to mirror it as well? :slight_smile:

Dann kann ich ja auch auf deutsch mit dir schreiben?!  :smiley:

Yeah that works just as well though I dont really have the answer to your resize issue :slight_smile:

Ah ok, now I get it… thanks!