Author Topic: [BUG] In scrollbar when changing elements in list  (Read 6692 times)

Shelt

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
[BUG] In scrollbar when changing elements in list
« on: August 10, 2012, 08:44:19 AM »
Hi NGUI,
I'm currently working with a text based inventory. It looks similar to the Quest Log tutorial made by you. I use however nested tables, which allows me to have dropdownlist under a dropdownlist. I first had trouble getting the table to reposition correctly, but solved it with adding a line of code in the reposition function that checks for table in the gameobjects parents and reposition those as well.

Now to the bug. I've added a scrollbar to the table allowing me to scroll when the list gets to large (elements get clipped). This works out fine until I close a tab in the list (similar to when you close a quest in your questlog example) while the scroll is in the bottom.

So to clarify: If I expand all items in the list the Scrollbar appear (since the list is so big). If the scroll button in the slider is at the top when I close a element, everything works fine and the scroll button in the slider expands to fit the table size since it doesn't have to scroll as much to see all elements in the list. If however the scrollbutton in the slider is at the very bottom and I after that close on of the tabs the scrollbar updates in the wrong direction. Its hard to describe better but instead of expanding upwards, it expands downwards making everything in the list jump a lot when I touch the scroll button in the slider.

So can you make a fix so the scrollbar and the table updates correctly when the scrollbutton is in the bottom of the slider and the elements in the table gets reduced so the slider size have to change.

Thanks,
Martin


*EDIT* Just tested your Quest Log example and you actual have the same problem there so you can easily test it yourself. Just expand all the items in the table, scroll down and minimize one of the element. The scroll then incorrectly updates and if you start drag the scroll you can see a major jump and reposition.
« Last Edit: August 10, 2012, 09:01:07 AM by Shelt »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [BUG] In scrollbar when changing elements in list
« Reply #1 on: August 10, 2012, 03:52:01 PM »
I think I know what you're talking about... The scroll bar is actually correct. The problem is in the clipped panel not being constrained when the list shrinks.

Pip Robbins

  • Guest
Re: [BUG] In scrollbar when changing elements in list
« Reply #2 on: February 20, 2013, 03:22:42 AM »
Was this ever fixed? I am currently having the exact same issue.

Is there a solution?

Also on a interesting note, I also had the exact same issue with the tables within tables. I still don't have that fixed. I am currently going through all the children reposition their tables then repositioning the parent table. Except it randomly bugs the label when adding child elements to different tables (similar to the quest log example etc the players can drag the elements around).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [BUG] In scrollbar when changing elements in list
« Reply #3 on: February 20, 2013, 06:58:29 AM »
Way to resurrect an old post. What version of NGUI?

Pip Robbins

  • Guest
Re: [BUG] In scrollbar when changing elements in list
« Reply #4 on: February 20, 2013, 04:51:18 PM »
The reason for posting in this thread was because its completely relevant to my issue. Normally forum communities prefer people search and posting in current threads before creating new ones.

Regardless sorry for resurrecting a old thread.

Now hoping for some constructive help :)

I am using latest version on NGUI. 2.3.3h
« Last Edit: February 20, 2013, 04:54:08 PM by Pip Robbins »

Pip Robbins

  • Guest
Re: [BUG] In scrollbar when changing elements in list
« Reply #5 on: February 20, 2013, 05:49:39 PM »
Just to clarify the issue to make sure there is no confusion.

I have a panel which I dynamically populate with buttons, those buttons also have buttons dynamically added to those as well.

Example

Panel
--Group Button
---- Sub Button
---- Sub Button
--Group Button
---- Sub Button

This is very similar to your quest log example.

Now the main bug is that I've added a scroll bar for when the list gets to large, which works fine, as I attach more buttons it shows the scrollbar and works perfectly. When I delete buttons if I am at the top of the scroll bar it is fine, but if I am at the bottom of the scroll bar it wont update, remaining in the same position, leaving blank space at the bottom where the button used to be. Now if enough buttons are delete to make the scroll bar disappear, then you have a huge gap at the bottom, your top elements are all cut off from the clipping plain and there is no way for the user to scroll back up.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [BUG] In scrollbar when changing elements in list
« Reply #6 on: February 20, 2013, 08:27:19 PM »
Try calling UIPanel.ConstrainTargetToBounds, or use UIPanel.CalculateConstraintOffset and use SpringPanel to adjust the position so that it's smooth.

Pip Robbins

  • Guest
Re: [BUG] In scrollbar when changing elements in list
« Reply #7 on: February 20, 2013, 10:10:28 PM »
Thank you!

UIPanel.ConstrainTargetToBounds ended up working.