ListView 1 with Director Class?

Hello,

I’m new to the forum and new to Corona SDK.

I was wondering if anyone could tell me how I could go about adding the ‘ListView 1’ example to a director application.

I have my current application working, and want to make it so when I press a button it goes to ‘listview1’.

I have previously tested these buttons with blank pages, so I can confirm the buttons do work, it just seems the ListView does not want to work, sending me a black screen every time I navigate to the page.

Along with getting the ListView to work, I was wondering if it is possible to make it so when you click a ListView item, it will go to a new page rather than saying “You pressed Item 1” or whatever.

If anyone can help me, it would be greatly appreciated. [import]uid: 88269 topic_id: 14668 reply_id: 314668[/import]

Hey,

It’s possible and I’m working on something similarish. You have the program the mylist (when you click on it) to have different properties and a way to tell what those are (I used tables). Then in listButtonRelease have a way to reference those properties and go to that page. It might not be the most efficient way but it worked for me.

Does that make sense? If not sorry, it’s the best way I could think of to describe it without posting most of my code that, while similar, isn’t 100% the same. [import]uid: 23649 topic_id: 14668 reply_id: 54244[/import]

Hey, thanks for your reply. I really appreciate it.

I finally managed to get the ListView loading, now I’m working on the listButtonRelease, however I’ve noticed every time I load the ListView, I get this error, and although it doesn’t effect the way the ListView runs (as far as I know), I’m not sure it should come up as an error:

http://i.imgur.com/KWKBQ.png

The only thing I changed in the ListView code was adding the following to the top of the ListView code:

[code]function new()
local group = display.newGroup()
local back = display.newRect( 0, 0, display.contentWidth, display.contentHeight)
back:setFillColor( 0,0,0)
group:insert(back)

local listData = {“Line1”,“Line2”,“Line3”,“whatever”}
local list = tableView.newList{
data = listData,
callback = function(row, id)
local t = display.newText( row, 0, 0, nil, size)
t:setTextColor(255,255,255)
return t
end
}
group:insert(list)

local function touchHandler( event )
if event.phase == “ended” then
director:changeScene(“mainForm”,“moveFromLeft”)
return true
end
end

back:addEventListener(“touch”, touchHandler)
return group
end

local director = require(“director”)[/code] [import]uid: 88269 topic_id: 14668 reply_id: 54256[/import]

Your error message photo is cut off but did you try moving director to the top of the page? [import]uid: 23649 topic_id: 14668 reply_id: 54287[/import]

Yeah when run, the error message does cut off on the 3rd line as shown in the screenshot.

Moving the director require to the top of the page does not seem to fix the issue.

I’m also having problems with the changing of scenes (listButtonRelease). Everything I try just doesn’t want to work.

I guess once I figure out the listButtonRelease, all my troubles will simply fade away and I can continue to make progression with the application.

It’s just so annoying though, as I’ve now decided to also use the same concept of listButtonRelease on the main list view, so that you can return to the previous scene (eg, going from ‘list’ to
‘menu’ in the following example)… eg: main, menu, list, content. [import]uid: 88269 topic_id: 14668 reply_id: 54354[/import]

Managed to get it all working perfectly. No errors at all.

Thanks very much for your help!

A little persistence can go a long way :slight_smile: [import]uid: 88269 topic_id: 14668 reply_id: 54362[/import]

i have the tableview and director running fine.

just one problem:

director does ignore my “moveFromRight” effect.
if I just open another scene it works fine.
but the scene with the tableview just appear without any effect!

greets
chris

[import]uid: 4795 topic_id: 14668 reply_id: 54420[/import]

@herihabbo How did you get this to work? I can’t figure out the listview director thing. [import]uid: 98804 topic_id: 14668 reply_id: 100538[/import]