Wrap text in listview

Does anybody know how to wrap the text in a listview?
I am trying this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
data[1] = {}
data[1].title = "Hot Coffee"
data[1].subtitle = "This is a really long text that I want to wrap but it does´t work.........HELP ME!!"
 
 
 
myList = tableView.newList{
        data=data, 
        default="listItemBg.png",
        over="listItemBg_over.png",
        onRelease=listButtonRelease,
        top=topBoundary,
        bottom=bottomBoundary,
    callback = function( row )
                         local g = display.newGroup()
 
                         local img = display.newImage(row.image)
                         g:insert(img)
                         img.x = math.floor(img.width*0.5 + 6)
                         img.y = math.floor(img.height*0.5) 
 
                         local title =  display.newText( row.title, 0, 0, native.systemFontBold, 14 )
                         title:setTextColor(0, 0, 0)
                         --title:setTextColor(255, 255, 255)
                         g:insert(title)
                         title.x = title.width*0.5 + img.width + 6
                         title.y = 30

newText and newRetinaText both take a 2nd set of parameters after the X, Y but before the font name that specify an optional "width" and height. Text will be wrapped if you specify a width. If you specify 0 for the height, there will be no vertical bounding box. If you specify a height other than zero, the text will be clipped if it extends out of the box.

local title = display.newText( row.title, 0, 0, 200, 0, native.systemFontBold, 14 )

Thank you!!

Maholm

views:1523 update:2012/2/7 8:40:54
corona forums © 2003-2011