Author Topic: ScrollView + Table + ScollBar = scrolling issues  (Read 6800 times)

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
ScrollView + Table + ScollBar = scrolling issues
« on: July 27, 2016, 12:00:20 PM »
I have a Panel which has a UIScrollView component on it, with a ScrollBar sibling.
Inside the Panel, I have a UITable widget with a list of things inside.

- ScrollBar
- Panel
    - UITable
        - Item1
        - Item2
        - Item3...

I want to be able to scroll this list, however I encounter several problems:

1) If I anchor the table to the top and bottom of the scroll view, I cannot scroll anymore, and I can see in the editor that the contents of the table are always repositionned, although an orange rectangle indicates that the area should be scrolled.

2) If I don't anchor the table, I can scroll it, even if there is no overflow. This causes the contents to be moved around the center of the ScrollView just because the ScrollBar can be dragged across a few pixels no matter what. I don't want this to happen, I want the items to start at the bottom of the panel's virtual area. I noticed the size property of the scrollbar is always below 1 (like 0.995).

3) If I set the ScrollBar to "only when needed", it auto-disappears when not hovered, and if the panel is resized it doesn't fades out and we can still drag it before it disappears. In addition, I don't want to hide the scrollbar anyways. Even if I hide it, the contents of the box still move around the middle when I resize it like in 2).

Any ideas how to fix this?
« Last Edit: July 29, 2016, 04:37:31 AM by Zylann »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollView + Table + ScollBar = scrolling issues
« Reply #1 on: July 29, 2016, 10:52:41 AM »
1. The panel's content should never be anchored to the panel itself. Panel is scrollable, anchored objects can't scroll. Seems kind of obvious.

2. Prevent dragging if fits or something like that is an option on your UIScrollView. As long as the contents fit, they won't be scrollable.

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: ScrollView + Table + ScollBar = scrolling issues
« Reply #2 on: August 01, 2016, 09:26:15 AM »
I removed the anchors so it can scroll, but even if I check "Cancel Drag if Fits", I still have this problem:



The orange rectangle can be seen in the editor.
As you can see the scrollbar still has a tiny amount of scrollable space, no matter what.
In addition, my ScrollView is expandable, and when I expand it I get the situation in the middle without even touching the scrollbar. I expected to be like the first image.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ScrollView + Table + ScollBar = scrolling issues
« Reply #3 on: August 03, 2016, 09:48:51 AM »
The former is actually intentional so that you can move the content around. That's how it is set up with the scroll bar. Cancel drag if fits affects the ability to scroll the content via the drag operation by pressing on the object itself (UIDragScrollView). You can set the scroll bar to hide if it's not needed, then you won't be able to drag it. I am not sure about the last part about resizing the scroll view though...