Thanks, Rob and ksan,
I corrected the “scope” problem and now at least something is visible on the simulator screen - the table is there but the text lines are below and underneath it.

@ksan
Thanks for that tip - that’s the best way to learn, looking at the existing code. I assume that in the example the data is loaded with these sections:
[lua]
– Insert the row into the tableView
tableView:insertRow
{
isCategory = isCategory,
rowHeight = rowHeight,
rowColor = rowColor,
lineColor = lineColor,
}
end
[/lua]
and
[lua]
– Handle row rendering
local function onRowRender( event )
local phase = event.phase
local row = event.row
– in graphics 2.0, the group contentWidth / contentHeight are initially 0, and expand once elements are inserted into the group.
– in order to use contentHeight properly, we cache the variable before inserting objects into the group
local groupContentHeight = row.contentHeight
local rowTitle = display.newText( row, "Row " … row.index, 0, 0, nil, 14 )
– in Graphics 2.0, the row.x is the center of the row, no longer the top left.
rowTitle.x = LEFT_PADDING
– we also set the anchorX of the text to 0, so the object is x-anchored at the left
rowTitle.anchorX = 0
print(rowTitle.x)
rowTitle.y = groupContentHeight * 0.5
rowTitle:setFillColor( 0, 0, 0 )
end
– Handle row updates
local function onRowUpdate( event )
local phase = event.phase
local row = event.row
– print( row.index, “: is now onscreen” )
end
[/lua]
which I added to my code now.
so my whole code is now:
[lua]
local widget = require( “widget” )
require(“sqlite3”)
local path = system.pathForFile(“mq.sqlite”, system.DocumentsDirectory )
file = io.open( path, “r” )
if( file == nil )then
pathSource = system.pathForFile( “mq.sqlite”, system.ResourceDirectory )
fileSource = io.open( pathSource, “rb” )
contentsSource = fileSource:read( “*a” )
pathDest = system.pathForFile( “mq.sqlite”, system.DocumentsDirectory )
fileDest = io.open( pathDest, “wb” )
fileDest:write( contentsSource )
io.close( fileSource )
io.close( fileDest )
end
db = sqlite3.open( path )
local function onSystemEvent( event )
if( event.type == “applicationExit”) then
db:close()
end
end
print ("version "…sqlite3.version())
print ("db path "…path)
local count =0
local sql = “SELECT * FROM allmq LIMIT 700”
for row in db:nrows(sql) do
count = count +1
local text = row.quote
local q = display.newText(text, 40, 40 +(20 * count), native.systemFont, 18)
q.anchorX = 0
q.anchorY = 0
q:setFillColor(255/255,120/255,50/255)
end
Runtime:addEventListener (“system”, onSystemEvent)
local widget = require( “widget” )
– Create the widget
local tableView = widget.newTableView
{
left = 10,
top = 20,
height = 430,
width = 320,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
listener = scrollListener
}
– Insert 640 rows
for i = 1, 640 do
local isCategory = false
local rowHeight = 36
local rowColor = { default={ 1, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }
local lineColor = { 0.5, 0.5, 0.5 }
– Insert a row into the tableView
tableView:insertRow(
{
isCategory = isCategory,
rowHeight = rowHeight,
rowColor = rowColor,
lineColor = lineColor,
}
)
end
– Handle row rendering
local function onRowRender( event )
local phase = event.phase
local row = event.row
– in graphics 2.0, the group contentWidth / contentHeight are initially 0, and expand once elements are inserted into the group.
– in order to use contentHeight properly, we cache the variable before inserting objects into the group
local groupContentHeight = row.contentHeight
local rowTitle = display.newText( row, "Row " … row.index, 0, 0, nil, 14 )
– in Graphics 2.0, the row.x is the center of the row, no longer the top left.
rowTitle.x = LEFT_PADDING
– we also set the anchorX of the text to 0, so the object is x-anchored at the left
rowTitle.anchorX = 0
print(rowTitle.x)
rowTitle.y = groupContentHeight * 0.5
rowTitle:setFillColor( 0, 0, 0 )
end
– Handle row updates
local function onRowUpdate( event )
local phase = event.phase
local row = event.row
– print( row.index, “: is now onscreen” )
end
[/lua]
But still I’m getting only what is in the image above.
I don’t know what has to be changed in this line though: local rowTitle = display.newText( row, "Row " … row.index, 0, 0, nil, 14 )
What am I missing?
keram