Hi! I’m having trouble with the widget scroller. I’ll show you my code and explain my problem, and hopefully you can help.
[lua]local scroller = widget.newScrollView{
top = 50,
height = 430,
scrollWidth = 320,
scrollHeight = 1800,
maskFile = “bitmapMask.png”,
bgColor = { 255, 255, 255, 0 },
}
local bladesbuttonfunction = function( event )
if event.phase == “moved” then
local dx = math.abs( event.x - event.xStart )
local dy = math.abs( event.y - event.yStart )
if dx > 5 or dy > 5 then
scroller:takeFocus( event )
end
elseif event.phase == “release” then
–some random stuff here…
end
return true
end
local bladesbutton = widget.newButton{
default = “bladesgreybutton.png”,
over = “bladesgreybuttonD.png”,
width = 80,
height = 87,
onEvent = bladesbuttonfunction,
}
bladesbutton.x = 60
bladesbutton.y = 115
scroller:insert(bladesbutton.view)[/lua]
So there it is… Everything is working as it did before I tried to include scrolling, except for the scrolling. When I click the button and try to drag it nothing happens and I get a runtime error in the terminal. It seems like the terminal prints the error once for every pixel I try to drag the button. Here’s the error:
Runtime error
/Users/nathanballi/Desktop//settingsmenu.lua:125: attempt to call method ‘takeFocus’ (a nil value)
stack traceback:
[C]: in function ‘takeFocus’
/Users/nathanballi/Desktop//settingsmenu.lua:125: in function ‘onEvent’
?: in function <?:90>
?: in function <?:215>
I hope you can help. Thanks!!
Nathan
I forgot to mention another problem. In the code above you'll notice that I've set the scroller height to an amount other then 480. I did this because I want to fill the extra space with a back button so it always remains in view. The problem is, when I scroll, everything that is being "scrolled" goes over the back button instead of behind. The back button is not overlapping the maskFile. How is this fixed?
Nathan [import]uid: 39302 topic\_id: 25529 reply\_id: 325529[/import]