display.newText multiple lines problem.

I use multiple textboxes using the display.newtext() function.
My problem is that they contain multiple lines of text and the textboxes is beneath each other. Sometimes the textbox above can contain a large number of lines of text and sometimes maybe just two lines of text. How can I set the position of the textbox beneath without getting the textboxes to collide or get a large whitespace between them?
Oskwish [import]uid: 24111 topic_id: 21951 reply_id: 321951[/import]

local topPadding = 10  
local leftPadding = 10  
local textBox1 = display.newText("a very long line...", 0,0,300,0,"Helvetica",32)  
textBox1:setReferencePoint(display.TopLeftReferencePoint)  
textBox1.x = leftPadding  
textBox1.y = topPadding  
local textBox2 = display.newText("another very long line...", 0, 0, 300, 0, "Helvetica", 32)  
textBox2:setReferencePoint(display.TopLeftReferencePoint)  
textBox2.x = leftPadding  
textBox2.y = textBox1.y + textBox1.contentHeight + topPadding  

Or something like that.
[import]uid: 19626 topic_id: 21951 reply_id: 87284[/import]

@robmiracle’s solution is fine if your not going to dynamically change the text later in the program. The problem is newText() does not automatically update it’s x and y properties after you change the text property.
If you need to change the text later in the code, you can do something like the following:

-- Create Text Object #1  
local myText1 = display.newText( "Text Block 1", 0, 0, native.systemFont, 20 )  
myText1:setTextColor( 255,110,110 )  
  
-- Create Text Object #2  
local myText2 = display.newText( "Text Block 2", 0, 0, native.systemFont, 20 );  
myText2:setTextColor( 255,255,110 );  
  
-- Function to Update the Text objects  
local function updateTextObjects(text1,text2)  
local paddingBetweenTextBlocks = 10  
myText1.text = text1  
myText1:setReferencePoint(display.TopLeftReferencePoint);  
myText1.x = 20  
myText1.y = 20  
myText2.text = text2  
myText2:setReferencePoint(display.TopLeftReferencePoint);  
myText2.x = 20  
myText2.y = myText1.y + myText1.contentHeight + paddingBetweenTextBlocks;  
  
end  
  
--Now Let's update the Text Objects  
updateTextObjects("hello\nBig\nBeautiful\nWorld!\nOne More Thing..\nHello Corona!!","This is the next\nText Block.")  

Hope this helps.
Jeff

[import]uid: 14119 topic_id: 21951 reply_id: 87294[/import]

This seems to work great Jeff! Thanks!
Oskwish [import]uid: 24111 topic_id: 21951 reply_id: 87525[/import]