Author Topic: Nested Scrollview - child SV doesn't get cliped by parent. Also other problems.  (Read 3749 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Scene description:

1. Popup button turns on/off the Categories in the ScrollView with a Table.
2. Each Category contains a ScrollView with a Grid.
3. Each Category is a prefab that's dynamically added to the Table.

Problems:
1. When the Categories are added, the items are not placed correctly. Have to click on the Category header to make it align properly.  In the code that generates the Category, Table.Reposition() was called.
2. items are not being clipped by the outer Category scrollView. This is intermittent,sometimes working other times not.
3. Item buttons disappear intermittently upon enabling,disabling of the Categories.
4. Edit:  Now in the video:  when there are multiple items in the row and the row is dragged to the left,  the entire Category row jumps to the right.  This was mentioned in another posting that has a prefab of the scene.

Here is a video clip showing the above problems.

https://dl.dropboxusercontent.com/u/48378123/NGUI_Nested_ScrollView_Problems.mp4


« Last Edit: May 12, 2014, 02:44:57 AM by wallabie »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
If you can create a repro case for me to look at, I'll see what's wrong. Please either email or PM me the download link -- don't post it here.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
All of the data is coming from a database  and it's hard to make a repos.

Have a look at the video.  It's demonstrating the problem. 
Basically, the problem is that whenever the rows are NGUITools.SetActive() on/off, then the problem occurs. 

Question:
1. The Category Go's have previously been created using instantiate,  references are stored in a Dictionary and attached to the Table. (catTrans.parent = table.transform)
2. The Item Buttons are also done in the same way as above and attached to the Grid. (btTrans.parent = grid.transform)

Since I'm not using NGUITools.Addchild, does this matter?

The approach of attaching instantiated Go's from elsewhere directly to the Grid/Table works well when the scrollViews are not nested.

Edit:  Just checked what NGUITools.Addchild does.  I'm already doing what this function does in my own code.  The reason I didn't use the Addchild is because I need to pre-instantiate the Go's and do processing on them before attaching to the tree/table.  So basically, the problem is with the nested scrollview.



« Last Edit: May 13, 2014, 12:45:35 AM by wallabie »

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Here is a video showing how the Item Buttons disappear and have to be manually activated to show up again.

https://dl.dropboxusercontent.com/u/48378123/NestedScrollView_Bt_Disappear.mp4

Here is the tree structure:

https://dl.dropboxusercontent.com/u/48378123/NestedScrollView_TreeStructure.jpg

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yes, it matters. NGUITools.AddChild does parenting before doing anything else, which is important.

After you change the parent, you must notify the widget that the parent has changed. NGUITools.MarkParentAsChanged.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
I'm not changing the parent.  I'm only doing setActive(true/false) on the children, with auto hide.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Everything works as expected in my tests here. I have several widgets clipped by 3 nested scroll views, and regardless of when and how I enable them, they all get clipped just fine. Same with dynamic instantiation.

I'll need some kind of a repro case to look at -- the smaller the better. Try to reproduce this issue in a clean project and a brand-new scene. It will either work as expected, letting you deduce what you did differently in your current scene, or it will give me something to look at while tracking down and fixing the issue.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Better yet, can you send me your test project so I can see how it should be set up ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
The post I referenced has the changes mentioned in it. You can apply them yourself.

Pre-releases are available in the Professional repository. It's part of the perks of going Pro. Another key advantage being able to test my proposed fixes immediately. As it stands, I don't package pre-releases for distribution. If you send me a small repro case to look at I can confirm if it was fixed or not though. And if it isn't -- investigate and fix it.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
I apply the changes and still the same problem.