Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Table View issue with custom scrollbar + workaround
Started by Benzeliden Jan 14 2018 02:27 AM

No replies to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Enthusiast

  • 80 posts
  • Corona SDK

Recently I played with custom scrollbar settings for Table view and noticed that if I'm trying to use wide scrollbar it appears cutted and ugly.


Attached File  screen1.png   4.94KB   0 downloads

I investigated widget repository - https://github.com/coronalabs/framework-widget and found root cause of this issue: in widgetLibrary/widget_momentumScrolling.lua file scrollbar width was set to:

local scrollBarWidth = options.width or 5

But there are no possibility to pass width into scroll options.


Some lines below width was determined another way:

opt.width = options.frameWidth or options.width or themeOptions.width

So based on my investigation I write hack to fix scroll position in code:

timer.performWithDelay(100, function()
        local fg = tableObject._view._fixedGroup
        fg.x = fg.x + 2.5 - scrollFrameSize * 0.5

2.5 is half of default width.

scrollFrameSize is scrollbar frame size that I use in code 

Timer is needed because scroll view will be created on next frame after table creation.


I also submited this issue to corona helpdesk and prepared pull request on github - https://github.com/coronalabs/framework-widget/pull/16


TL;DR; If you want to use custom scrollbar with width > 5px then use code above to fix it position