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"
Monthly Archives: January 2012
How do the x and y positions work for arranging items on the screen?
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.
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.
How can I figure out the screen resolutions of devices that I can develop for using the Corona SDK?
Here is a partial lsiting of the devices the Corona SDK supports, and their native resolution:
Device | Width | Height | PPI |
---|---|---|---|
iPad | 768 | 1024 | ? |
iPod Touch | 320 | 480 | ? |
iPhone | 320 | 480 | ? |
Kindle Fire (Amazon) | 600 | 1024 | 169 |
iPhone | 320 | 480 | ? |
iPhone | 320 | 480 | ? |