Is scrollToY broken on tableviews?

I am trying to auto scroll a table view, but keep getting the error : attempt to index a number value

I’m using build 1171. I don’t think I’m doing anything untoward, here is the code:

--list creation local listOptions = { width = 500, height = 240, scrollWidth = 768, scrollHeight = 1024, bottomPadding= 40, friction=0.935, onRowRender = onRowRender, hideScrollBar = true, hideBackground=true, maskFile = "imageSheets/score\_mask.png" } scoresList = widget.newTableView(listOptions) --add some rows for i=1,#hiScores,1 do scoresList:insertRow { rowColor=rowColor, lineColor={255,0,0,0}, onRender=onRowRender, rowHeight=40, id=hiScores[i], onEvent = nil } end --then when I want to auto scroll the table I try to use: local currentY = scoresList:getContentPosition() scoresList:scrollToY(currentY - 100,0)--this line is where the error occurs --or even just this scoresList:scrollToY(100, 0)

But I always get the same error on the scrollToY function, but I don’t know why.

Hi @AlanPlantPot,

Did this work on former builds? I’d like to confirm if it’s been a bug, or if it’s a newer regression bug.

Thanks,

Brent

I’d only just implemented it in my code, so never actually tried it on an older build (and I’m reluctant to have multiple version of Corona on my machine in case it messes up Enterprise somehow).

Has anyone else noticed the same bug?

Hi @AlanPlantPot,

I’m hesitant to put this back into the bug system, unless somebody else reports the same issue. Another developer recently commented that some widget feature wasn’t behaving properly in an Enterprise test, but he tried it in a normal daily build and everything worked as expected. So, let’s see how this unfolds… if another user confirms it, then I’ll put it before the engineers to get fixed.

Take care,

Brent

Hi Alan,

I just checked on a recent-ish daily build…and this is a code issue on your part. Sorry. :wink:

As it says in the documentation, :scrollToY accepts a single variable (called “options”) which must be a table.

The exact format is:

{ y = 300, -- the y position to go to, almost always negative (REQUIRED) time = 200, -- time to travel, in ms (OPTIONAL) onComplete = doSomething, -- function to call when you get there. (OPTIONAL) }

So in your code, you must use it like this:

scoresList:scrollToY{ y = currentY - 100, time = 0, }

So the error message given was correct, because it needs the y position in a table and not as a sole variable. :slight_smile:

richard9 you are quite right, it does work.

I’m not sure where I saw it listed as the scrollToY(position, time) rather than using a table. I was so sure I’d checked it multiple times.  

Apologies Brent, there’s no need to file this as a bug.

Hi @AlanPlantPot,

Did this work on former builds? I’d like to confirm if it’s been a bug, or if it’s a newer regression bug.

Thanks,

Brent

I’d only just implemented it in my code, so never actually tried it on an older build (and I’m reluctant to have multiple version of Corona on my machine in case it messes up Enterprise somehow).

Has anyone else noticed the same bug?

Hi @AlanPlantPot,

I’m hesitant to put this back into the bug system, unless somebody else reports the same issue. Another developer recently commented that some widget feature wasn’t behaving properly in an Enterprise test, but he tried it in a normal daily build and everything worked as expected. So, let’s see how this unfolds… if another user confirms it, then I’ll put it before the engineers to get fixed.

Take care,

Brent

Hi Alan,

I just checked on a recent-ish daily build…and this is a code issue on your part. Sorry. :wink:

As it says in the documentation, :scrollToY accepts a single variable (called “options”) which must be a table.

The exact format is:

{ y = 300, -- the y position to go to, almost always negative (REQUIRED) time = 200, -- time to travel, in ms (OPTIONAL) onComplete = doSomething, -- function to call when you get there. (OPTIONAL) }

So in your code, you must use it like this:

scoresList:scrollToY{ y = currentY - 100, time = 0, }

So the error message given was correct, because it needs the y position in a table and not as a sole variable. :slight_smile:

richard9 you are quite right, it does work.

I’m not sure where I saw it listed as the scrollToY(position, time) rather than using a table. I was so sure I’d checked it multiple times.  

Apologies Brent, there’s no need to file this as a bug.