Scrolling Lists

Hi, I am creating an informational app that includes scrolling lists but i can’t just get it to work. How can I get the bottom code to work on a “menu.lua” file, not on a “main.lua” file. Thank you.
[lua]–import the table view library
local tableView = require(“tableView”)

–import the button events library
local ui = require(“ui”)

display.setStatusBar( display.HiddenStatusBar )

–initial values
local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight

local myList, backBtn, detailScreenText

local background = display.newRect(0, 0, display.contentWidth, display.contentHeight)
background:setFillColor(77, 77, 77)

–setup a destination for the list items
local detailScreen = display.newGroup()

local detailBg = display.newRect(0,0,display.contentWidth,display.contentHeight-display.screenOriginY)
detailBg:setFillColor(255,255,255)
detailScreen:insert(detailBg)

detailScreenText = display.newText(“You tapped item”, 0, 0, native.systemFontBold, 24)
detailScreenText:setTextColor(0, 0, 0)
detailScreen:insert(detailScreenText)
detailScreenText.x = math.floor(display.contentWidth/2)
detailScreenText.y = math.floor(display.contentHeight/2)
detailScreen.x = display.contentWidth

–setup functions to execute on touch of the list view items
function listButtonRelease( event )
self = event.target
local id = self.id
print(self.id)

detailScreenText.text = "You tapped item "… self.id

transition.to(myList, {time=400, x=display.contentWidth*-1, transition=easing.outExpo })
transition.to(detailScreen, {time=400, x=0, transition=easing.outExpo })
transition.to(backBtn, {time=400, x=math.floor(backBtn.width/2) + screenOffsetW*.5 + 6, transition=easing.outExpo })
transition.to(backBtn, {time=400, alpha=1 })

delta, velocity = 0, 0
end

function backBtnRelease( event )
print(“back button released”)
transition.to(myList, {time=400, x=0, transition=easing.outExpo })
transition.to(detailScreen, {time=400, x=display.contentWidth, transition=easing.outExpo })
transition.to(backBtn, {time=400, x=math.floor(backBtn.width/2)+backBtn.width, transition=easing.outExpo })
transition.to(backBtn, {time=400, alpha=0 })

delta, velocity = 0, 0
end

– setup some data
local data = {}
for i=1, 20 do
data[i] = "List item "… i
end

local topBoundary = display.screenOriginY + 40
local bottomBoundary = display.screenOriginY + 0

– create the list of items
myList = tableView.newList{
data=data,
default=“listItemBg.png”,
over=“listItemBg_over.png”,
onRelease=listButtonRelease,
top=topBoundary,
bottom=bottomBoundary,
backgroundColor={ 255, 255, 255 },
callback=function(row)
local t = display.newText(row, 0, 0, native.systemFontBold, 16)
t:setTextColor(0, 0, 0)
t.x = math.floor(t.width/2) + 12
t.y = 46
return t
end
}

–Setup the nav bar
local navBar = display.newImage(“navBar.png”, 0, 0, true)
navBar.x = display.contentWidth*.5
navBar.y = math.floor(display.screenOriginY + navBar.height*0.5)

local navHeader = display.newText(“My List”, 0, 0, native.systemFontBold, 16)
navHeader:setTextColor(255, 255, 255)
navHeader.x = display.contentWidth*.5
navHeader.y = navBar.y

–Setup the back button
backBtn = ui.newButton{
default = “backButton.png”,
over = “backButton_over.png”,
onRelease = backBtnRelease
}
backBtn.x = math.floor(backBtn.width/2) + backBtn.width + screenOffsetW
backBtn.y = navBar.y
backBtn.alpha = 0 [import]uid: 132369 topic_id: 35320 reply_id: 335320[/import]

Are you getting any specific errors? We need a little better description beyond “it’s just not working” to be able to have a starting point.

How are you getting to menu.lua? Are you using Director or Storyboard? If so are you inserting the tableView into the display group?

What build of Corona are you using?
Are you using this blog post: http://www.coronalabs.com/blog/2010/09/24/create-scrolling-list-views-with-text-and-graphics-in-coronasdk-ios-android-tutorial/

???

[import]uid: 199310 topic_id: 35320 reply_id: 140410[/import]

Sorry about that, I managed to fix it. My return group was different than my display.newGroup. Thank you [import]uid: 132369 topic_id: 35320 reply_id: 140457[/import]

Are you getting any specific errors? We need a little better description beyond “it’s just not working” to be able to have a starting point.

How are you getting to menu.lua? Are you using Director or Storyboard? If so are you inserting the tableView into the display group?

What build of Corona are you using?
Are you using this blog post: http://www.coronalabs.com/blog/2010/09/24/create-scrolling-list-views-with-text-and-graphics-in-coronasdk-ios-android-tutorial/

???

[import]uid: 199310 topic_id: 35320 reply_id: 140410[/import]

Sorry about that, I managed to fix it. My return group was different than my display.newGroup. Thank you [import]uid: 132369 topic_id: 35320 reply_id: 140457[/import]