Author Topic: Accordion-like interface  (Read 3203 times)

m0rgul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Accordion-like interface
« on: August 05, 2014, 03:13:12 PM »
Hello everyone!

I am having some issues with something. I am trying to build an accordion-like interface, that is I have some labels and once you click on them a window appears underneath and pushes everything down.

I have managed to make all that work with anchoring and some scripting. However, if I happen to have more than 3 of these windows I would need to add a scrollbar to it...and there lies my problem.

I create a scrollview, take these...widgets, put them under the scrollview as children, throw in a scrollbar and...nothing happens. When I expand my widgets they do get clipped, at some point I even got the scrollbar to show, but whenever I drag it, nothing happens...

What am I missing?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Accordion-like interface
« Reply #1 on: August 06, 2014, 08:38:04 PM »
You should use a table, not anchoring. Anchor movements won't inform the scroll view that the child dimensions changed, and won't make it update the scroll bar in turn.

A table informs the scroll view, so the scroll bar will be updated. Check the Quest Log example that comes with NGUI.

Alternatively you will need to notify the scroll view yourself.

m0rgul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Accordion-like interface
« Reply #2 on: August 07, 2014, 05:19:24 AM »
Yup, that is what I did in the end...on the tween callback for the widgets I tell the scrollview to recheck contents and refresh the scrollbar...and it works wonderfully.

Thanks for the help. I will however look into tables as well, might be a better solution...