local function handlerFunction(event)
    if event.phase == "submitted" then
        local enteredText = editField.text
        --enteredText now has the value of the text field.
        print(enteredText)
        native.setKeyboardFocus(nil)
    end
end

local editField = native.newTextField( 10, 125, 300, 36, handlerFunction )
--This sets (prefills) the text field value.
editField.text = "some pre-filled text"

The x and y coordinates represent pixels on the screen. X is the horizontal postion, and y is the vertical  position. It is important to note that the x and y coordinates also depend on the the object’s reference point, as the x and y coordinates are relative to the this.

X And Y Positioning Illustration

As defined by Corona:

object.x: specifies the x-position (in local coordinates) of the object relative to the parent — the parent’s origin to be precise. Specifically, it provides the x-position of the object’s reference point relative to the parent. Changing the value of this will move the object in the x-direction. Changing the object’s reference point will change the object’s x and y points without moving the object.

object.y: specifies the y-position (in local coordinates) of the object relative to the parent — the parent’s origin to be precise. Specifically, it provides the y-position of the object’s reference point relative to the parent. Changing the value of this will move the object in the y-direction. Changing the object’s reference point will change the object’s x and y points without moving the object.

 

%d bloggers like this: