I am trying here to populate a GridView but when number of items increase, and screen not sufficient to cover them all then I need to scroll the GridView as it is not autoScrollable. So I am using ScrollView and inserting GridView in it but its not accepting it.
My code so far is
[lua]
display.setStatusBar( display.DefaultStatusBar )
local widget = require( “widget” )
local gridView = require(“gridView”)
local scrollView = widget.newScrollView
{
left = 0,
top = 0,
width = display.contentWidth,
height = display.contentHeight,
id = “onBottom”,
horizontalScrollDisabled = true,
verticalScrollDisabled = true,
listener = scrollListener,
}
local photoArray = {“assets/pic1.png”,“assets/pic1.png”,“assets/pic2.png”,“assets/pic3.png”,“assets/pic4.png”,“assets/pic5.png”,“assets/pic5.png”}
local photoTextArray = {“pic7”,“pic1”,“pic2”,“pic3”,“pic4”,“pic5 Long Text Test”,“pic6”}
gridView:new(25, 50, photoArray, photoTextArray, 2, 10, 20,150, 150, gridListener)
scrollView:insert( gridView ) – this line giving error
–Process the event when user click on the grid
local function gridListener(index)
print("You select item "…index)
end
[/lua]