Widget fixes

I have posted my fixes for the widgets api on GitHub so anyone can browse it, see changes, suggest fixes and contribute.

This is a continuation of the conversation started here.

If you have a fix you think should be included make a pull request on GitHub or post the fix here.

Currently only scroll view and table view fixes are included.

For instructions on how to use the fixes and fix descriptions read the readme.txt in appropriate build folder.

GitHub repository can be found here.

Quick list of fixes for 2014.2189:

  • scroll view and table view will not jump back to starting position if scrolling in opposite direction before bounce back has completed (vertical and horizontal)

  • exposed scrollView:updateScrollAreaSize() for making sure the scroll works correctly when moving objects inside the scroll view

  • fixed some issues when using multiple scroll views or table views at the same time

  • scroll view and table view now respect the vertical scrolling threshold

  • fixed table view bug when deleting multiple rows

  • fixed table view deleteRow bug that says table view is scrolling when it’s not and doesn’t allow delete

  • all scrollTo methods for scrollView and tableView return the transition handle so it can be canceled if needed

Primoz

Super! Now Alex can just accept the pull request and we all get the update in hopefully a nearby daily build… Meanwhile, let me head over to your GitHub page. Thanks much for sharing!!!

Well alex can check for changes if he likes but I can not make a pull request as I didn’t make a branch of corona repository. I made a new one as I only included files for scroll view and table view. Anyone can make a pull request with this fixes on the corona repository if they wish.

Oh I see what you did. Not a problem. Free fixes should always be welcome to Corona Labs. It does save time for all involved. Thank you very much!!!

Perfection. thank you!

Super! Now Alex can just accept the pull request and we all get the update in hopefully a nearby daily build… Meanwhile, let me head over to your GitHub page. Thanks much for sharing!!!

Well alex can check for changes if he likes but I can not make a pull request as I didn’t make a branch of corona repository. I made a new one as I only included files for scroll view and table view. Anyone can make a pull request with this fixes on the corona repository if they wish.

Oh I see what you did. Not a problem. Free fixes should always be welcome to Corona Labs. It does save time for all involved. Thank you very much!!!

Perfection. thank you!

I still have problems with TableView…

So, I downloaded this code and followed the instructions…

It works better now! I can drag the tableview and it don’t comes back to the original y position. OK, thats fine!

But now, when I go very up or down dragging the tableview, the widget returns an error and I lost part of the row contents.

I have 4 or 5 big elements per row (pictures of books). So, I have very few rows: only 3 or 4. 

Any ideas about what happens when I go far up or down?

Thanks!

Josep Alemany

Well I can’t be sure without seeing the error and your code.

First It would be good to post the error that you get.

I’m just guessing here but if you get an error while scrolling, the problem is probably in your onRowRender function.

Hi Primoz, 

The error message is this:

https://www.dropbox.com/s/eopgxo0cvhq6y7x/TableView.png?dl=0

It happens when some users move to much quick the tableview.

Another problem that happens is:

When I go very up or very down and return to the rows positions, the images of the rows are changed and/or disappear… :frowning:

I have tried to control the movement with a listener:

read the contentPosition and then a tableView:scrollToY.

As the images disappear I want to limit the y coordinates to scroll but, it didn’t work.

Any help is welcome! Thanks

Well the error is telling you that the problem is on line 767 of your page_2.lua file. What you do there I do not know but you are trying to read a table entry on an empty table.

This would give you the same error:

local t = nil

local v = t.something

The dissapearing images might be caused by this error or another one in your onRowRender listener.

You have to understand that when you move the tableview rows that go out of view are removed from stage and when they come back into view your onRowRender listener is called again to draw the table contents. Check your values in the onRowRender listener to find the problem.

Limiting scroll that way will probably be less than smooth. This should happen automatically when you delete a row from tableview. You should not just remove the objects (images/text) you place in the row you should delete the rows using tableView.deleteRow(index). This should update the scroll size on it’s own.

I still have problems with TableView…

So, I downloaded this code and followed the instructions…

It works better now! I can drag the tableview and it don’t comes back to the original y position. OK, thats fine!

But now, when I go very up or down dragging the tableview, the widget returns an error and I lost part of the row contents.

I have 4 or 5 big elements per row (pictures of books). So, I have very few rows: only 3 or 4. 

Any ideas about what happens when I go far up or down?

Thanks!

Josep Alemany

Well I can’t be sure without seeing the error and your code.

First It would be good to post the error that you get.

I’m just guessing here but if you get an error while scrolling, the problem is probably in your onRowRender function.

Hi Primoz, 

The error message is this:

https://www.dropbox.com/s/eopgxo0cvhq6y7x/TableView.png?dl=0

It happens when some users move to much quick the tableview.

Another problem that happens is:

When I go very up or very down and return to the rows positions, the images of the rows are changed and/or disappear… :frowning:

I have tried to control the movement with a listener:

read the contentPosition and then a tableView:scrollToY.

As the images disappear I want to limit the y coordinates to scroll but, it didn’t work.

Any help is welcome! Thanks

Well the error is telling you that the problem is on line 767 of your page_2.lua file. What you do there I do not know but you are trying to read a table entry on an empty table.

This would give you the same error:

local t = nil

local v = t.something

The dissapearing images might be caused by this error or another one in your onRowRender listener.

You have to understand that when you move the tableview rows that go out of view are removed from stage and when they come back into view your onRowRender listener is called again to draw the table contents. Check your values in the onRowRender listener to find the problem.

Limiting scroll that way will probably be less than smooth. This should happen automatically when you delete a row from tableview. You should not just remove the objects (images/text) you place in the row you should delete the rows using tableView.deleteRow(index). This should update the scroll size on it’s own.