native.newTextBox not displaying in the correct location on iOS devices.

Hey,

native.newTextBox doesn’t appear to be displaying in the correct location on my iOS devices (iPad 3 and 3GS).

In the attached jpeg the white box should be in the middle of the screen (sorry for the red marker, I had some inappropriate text that I added out of frustration :slight_smile: ).  And the size is wrong as well, should be the same as the yellow boxes.

[lua]

        self.beforeGameTextBox = native.newTextBox( 0,0, self.yellowbox.Width - 10,self.yellowbox.Height - 10 )

        self.beforeGameTextBox.x,self.beforeGameTextBox.y=display.contentCenterX,display.contentCenterY

        self.beforeGameTextBox.font = native.newFont( “Helvetica-Light”, 18 )

        self.beforeGameTextBox.isEditable = true

        self.beforeGameTextBox.id = “beforeGameText”

        self.beforeGameTextBox:addEventListener( “userInput”, self )

[/lua]

Thanks,

Craig

Hi Craig,

Is there any kind of display group shifting or scaling going on here, or scaling of the yellow box, or something like that?

Brent

Hi Brent,

I have put together a simple test case (nothing but textBox) and the same thing happens.  I was using Robs config.lua but the same thing happens with a standard config.lua

main.lua

[lua]

local function userInput( event )

    print(“in input listener”)

    local target =  event.target.id

    if event.phase == “began” then

        print(“textbox began”, event.target.id)

        

    elseif event.phase == “ended” then

        print(“it has stopped editing”)

        local fieldUpdate, valueUpdate

    elseif event.phase == “editing” then

        print(“textbox editing”, event.target.id)

    end

end

local boxHeight,boxWidth = 300, 700

local beforeTextRect = display.newRoundedRect(0,0,boxWidth, boxHeight,15)

beforeTextRect.isHitTestable = true

beforeTextRect.x = display.contentCenterX

beforeTextRect.y =display.contentCenterY

beforeTextRect.strokeWidth = 5

beforeTextRect:setFillColor( 1, 1, 0 )

beforeTextRect:setStrokeColor( 1, 0, 0 )

local beforeGameTextBox = native.newTextBox( 0,0, boxWidth,boxHeight)

beforeGameTextBox.x,beforeGameTextBox.y=display.contentCenterX,display.contentCenterY

beforeGameTextBox.font = native.newFont( “Helvetica-Light”, 18 )

beforeGameTextBox.isEditable = true

beforeGameTextBox.id = “beforeGameText”

beforeGameTextBox:addEventListener( “userInput”, userInput )

[/lua]

config.lua

[lua]

application =

{

    content =

    {

        width = 800,

        height = 1200,

        scale = “letterBox”

    },

}

[/lua]

Thanks,

Craig

Bug reported - Case 29851

You guys are awesome!  Bug fixed in latest build!

Hi Craig,

Is there any kind of display group shifting or scaling going on here, or scaling of the yellow box, or something like that?

Brent

Hi Brent,

I have put together a simple test case (nothing but textBox) and the same thing happens.  I was using Robs config.lua but the same thing happens with a standard config.lua

main.lua

[lua]

local function userInput( event )

    print(“in input listener”)

    local target =  event.target.id

    if event.phase == “began” then

        print(“textbox began”, event.target.id)

        

    elseif event.phase == “ended” then

        print(“it has stopped editing”)

        local fieldUpdate, valueUpdate

    elseif event.phase == “editing” then

        print(“textbox editing”, event.target.id)

    end

end

local boxHeight,boxWidth = 300, 700

local beforeTextRect = display.newRoundedRect(0,0,boxWidth, boxHeight,15)

beforeTextRect.isHitTestable = true

beforeTextRect.x = display.contentCenterX

beforeTextRect.y =display.contentCenterY

beforeTextRect.strokeWidth = 5

beforeTextRect:setFillColor( 1, 1, 0 )

beforeTextRect:setStrokeColor( 1, 0, 0 )

local beforeGameTextBox = native.newTextBox( 0,0, boxWidth,boxHeight)

beforeGameTextBox.x,beforeGameTextBox.y=display.contentCenterX,display.contentCenterY

beforeGameTextBox.font = native.newFont( “Helvetica-Light”, 18 )

beforeGameTextBox.isEditable = true

beforeGameTextBox.id = “beforeGameText”

beforeGameTextBox:addEventListener( “userInput”, userInput )

[/lua]

config.lua

[lua]

application =

{

    content =

    {

        width = 800,

        height = 1200,

        scale = “letterBox”

    },

}

[/lua]

Thanks,

Craig

Bug reported - Case 29851

You guys are awesome!  Bug fixed in latest build!