Scrollbar in wrong position in Widget 2.0 scrollView

Hi all,

I have an odd problem with the scrollbar on the new scrollView widget. 

Scrolling itself works fine, but the scrollbar starts half way down my scroll area and disappears off the bottom under my mask as I scroll down (so essentially it’s offset vertically by about 150 pixels).

Code below. Has anyone experienced anything similar to this? It doesn’t always happen - one time it will happen and then the next it won’t. Weird!

I’d obviously like to fix it but if that’s not possible is there any way to hide the scrollbar? Like I say, scrolling works perfectly, it’s just that the scrollbar is off position.

Thanks,

Ian

    local widget = require "widget"          -- \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*     -- IMAGE SHEET     local options =     {         -- array of tables representing each frame (required)         frames =         {             -- 3 pieces             { x = 0, y = 0, width = 6, height = 6 },             { x = 0, y = 6, width = 6, height = 18 },             { x = 0, y = 24, width = 6, height = 6 },         },         -- optional params; used for dynamic resolution support         sheetContentWidth = 6,         sheetContentHeight = 30,     }     local imageSheet = graphics.newImageSheet( "scrollbar.png", options )     sv = widget.newScrollView{         width = w,         height = h,         maskFile = maskFileName,         horizontalScrollDisabled = true,         backgroundColor = {255,255,255,0},         scrollBarOptions = {             sheet = imageSheet,             topFrame = 1,             middleFrame = 2,             bottomFrame = 3,         },     }          sv.isHitTestMasked = true;     sv.x = px;     sv.y = py;     sv:insert( content );     layer:insert( sv );  

Hi @keystagefun,

Did you check all of the parameters in the ScrollView documentation?

http://docs.coronalabs.com/api/library/widget/newScrollView.html

I see that you’ve specified the width and height, but no “scrollWidth” and “scrollHeight”. This might be why the scrollbar isn’t behaving as you expect. Please try that and let me know what happens.

Thanks,

Brent

Hi Brent,

Thanks for the reply. Sorry for the delay in responding - I was away.

I’ve tried adding scrollWidth and scrollHeight in but it makes no difference. I’m still seeing a scrollbar that starts half way down my scroll area and then disappears off the page as I scroll. The odd thing is this doesn’t happen on all scrollviews but I can’t see any difference between the ones where it does work and doesn’t work.

Is there any way to just disable the scrollbar completely so it doesn’t appear? I can then add my own which will work.

Thanks,

Ian

I wonder if your masking has anything to do with this issue… 

In the meanwhile, you an use the following to hide the scrollview. Good luck! 

hideScrollBar (optional)

Boolean. Set this to true if you do not want to use a scrollBar in your ScrollView.

Hi @keystagefun,

Did you check all of the parameters in the ScrollView documentation?

http://docs.coronalabs.com/api/library/widget/newScrollView.html

I see that you’ve specified the width and height, but no “scrollWidth” and “scrollHeight”. This might be why the scrollbar isn’t behaving as you expect. Please try that and let me know what happens.

Thanks,

Brent

Hi Brent,

Thanks for the reply. Sorry for the delay in responding - I was away.

I’ve tried adding scrollWidth and scrollHeight in but it makes no difference. I’m still seeing a scrollbar that starts half way down my scroll area and then disappears off the page as I scroll. The odd thing is this doesn’t happen on all scrollviews but I can’t see any difference between the ones where it does work and doesn’t work.

Is there any way to just disable the scrollbar completely so it doesn’t appear? I can then add my own which will work.

Thanks,

Ian

I wonder if your masking has anything to do with this issue… 

In the meanwhile, you an use the following to hide the scrollview. Good luck! 

hideScrollBar (optional)

Boolean. Set this to true if you do not want to use a scrollBar in your ScrollView.