Scrollview Not Scrolling.

Hi, I’m setting a height of 400 and a scrollHeight of 1900 but the scroll always comes back to the initial position.

 

This code worked in previous builds (1038) is there something else I must do?

 

Thanks.

 

Here is my code if someone can help:

 

 

myClass:load(left, top, width, height, mask )

 

    local function scrollListener(event)

        return self:onScroll(event)

    end

    self._scrollView = widget.newScrollView{                                        

                                    left=left,

                                    top=top,

                                    width=width,

                                    height=height,                               

                                    scrollWidth = self._scrollWidth,

                                    scrollHeight = self._scrollHeight,

                                    hideBackground=self._hideBackground,

                                    backgroundColor={0,0,0,255},                                    

                                    hideScrollBar=self._hideScrollBar,

                                    maskFile=mask,

                                    verticalScrollDisabled=(not self._isVertical),

                                    horizontalScrollDisabled=(not self._isHorizontal),

                                    friction = self._friction,

                                    listener = scrollListener

                                    }

        

    if (mask) then

        self._scrollView.isHitTestMasked = true

    end

 

    self._listeners = {}

    self._displayGroup:insert(self._scrollView)   

    self._isActive = true

    self._x = 0

    self._y = 0

end

 

All values entered to the Scroll view are correct I had this code working properly on version 1038, but now it just stopped working. I’ve tried to mimic the scrollView sample code and it’s got the same code… I don’t know what I could be doing wrong…

BTW, the code works perfectly in build 1036. Something changed later.

Having the exact same problem. This was broken, then it was fixed and now it’s broken again.

 

Thanks,

 

Ian

Hey Guys any chance we can get this fixed on next daily build?

I got it working now. My problem was that I was inserting an empty group into my ScrollView and then adding other things (buttons, text etc.) into that group rather than directly into the ScrollView.

Are you doing something similar?

Essentially it seemed to think that because I had added this empty group to the ScrollView, the height of the scrollable content was zero. Adding stuff into that group never alerted the ScrollView that the height was now beyond the ScrollView’s height - it still thought it was zero.

By doing away with that extra group, everything now works fine for me.

Where is the line in your code where you actually add the content to your ScrollView?

Thanks,

Ian

Please reply to the below question by keystagefun, as there are no pending bugs regarding scrollView’s not scrolling.

As far as I know I’m not creating my scrollview wiht empty components, as they’re added to it after creation, and are multiple displayGroups wiht images in them.

I mean this is working perfectly wiht 1036 I don’t see why this has changed now… :S

BTW my code for adding components:

--============================================================================= -- Adds a component to the current components and register such component in the  -- scroll view. Also it defines the .\_scroll parameter used in that component -- in order to be able to propagate focus. --============================================================================= function RBDragListComponent:addComponent(name, component)     self.\_components[name] = component     self.\_components[name]:setParent(self)     component.\_scroll = self     self.\_scrollView:insert(component.\_displayGroup) end  

Hmmm. Not sure. If you’re adding an empty group to your scrollview and then adding components dynamically afterwards that would cause the same issue I had.

If so, try adding the components directly to the scrollview (i.e., not into a group you inserted into the scrollview - so skip the step of adding the extra empty group basically).

If this isn’t what you’re doing then I don’t know I’m afraid. Probably worth filing a bug with Corona.

Thanks,

Ian

Just an idea but what happens if you re-insert your group into the scrollView after you’ve finished adding new objects?

“I fixed it”, seems that the display groups are not updating their size, when you add an hierarchy of displayGroups, and position them, I’ve set manually the width of that display group and it works. adding components to an empty group and then afterwards adding it to the scroll… this seems some sinister change in displayGroup size calculation method… and as I was saying this shouldn’t had stop working… I mean this is working perfectly in 1036 I don’t see why it’s not now… but as I say seems something in the displayGroup is not working.

And thanks for your help guys, I’ll try to workaround it but seems it will fail other cases…

Does inserting the group into the scrollView with a slight delay also fix it? 

ie:

timer.performWithDelay( 1, function() scrollView:insert( group ) end)

It does!! :slight_smile: it’s fixed adding the delay.

Thanks very much!! :slight_smile:

In that case daily build 1060 may resolve the issue for you without you having to do that. Give it a whirl and let me know

I’m using 1060 already :D in fact was the first thing I tried :slight_smile:

BTW, the code works perfectly in build 1036. Something changed later.

Having the exact same problem. This was broken, then it was fixed and now it’s broken again.

 

Thanks,

 

Ian

Hey Guys any chance we can get this fixed on next daily build?

I got it working now. My problem was that I was inserting an empty group into my ScrollView and then adding other things (buttons, text etc.) into that group rather than directly into the ScrollView.

Are you doing something similar?

Essentially it seemed to think that because I had added this empty group to the ScrollView, the height of the scrollable content was zero. Adding stuff into that group never alerted the ScrollView that the height was now beyond the ScrollView’s height - it still thought it was zero.

By doing away with that extra group, everything now works fine for me.

Where is the line in your code where you actually add the content to your ScrollView?

Thanks,

Ian

Please reply to the below question by keystagefun, as there are no pending bugs regarding scrollView’s not scrolling.

As far as I know I’m not creating my scrollview wiht empty components, as they’re added to it after creation, and are multiple displayGroups wiht images in them.

I mean this is working perfectly wiht 1036 I don’t see why this has changed now… :S

BTW my code for adding components:

--============================================================================= -- Adds a component to the current components and register such component in the  -- scroll view. Also it defines the .\_scroll parameter used in that component -- in order to be able to propagate focus. --============================================================================= function RBDragListComponent:addComponent(name, component)     self.\_components[name] = component     self.\_components[name]:setParent(self)     component.\_scroll = self     self.\_scrollView:insert(component.\_displayGroup) end