Author Topic: Layout items up with UITable  (Read 1662 times)

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Layout items up with UITable
« on: July 27, 2016, 06:50:17 AM »
I am trying to build a chat system with a reusable "list of things" code which depends on UITable.
So I want to have the last item at the bottom, and previous items are up.

The problem is, I cannot get it to start where I want:


If I set Direction to Up, the text starts where I want but in the wrong order. Why are the items being layout outside the widget when I set Down?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Layout items up with UITable
« Reply #1 on: July 29, 2016, 10:44:40 AM »
NGUI comes with a component called UITextList that does this for you. It doesn't use a table, but it does use one label that's scrollable and supports many paragraphs in the "latest on the bottom" style. As a bonus it's way faster than using a table.

Off the top of my head, the UITable should be on a child game object of your widget, not on the widget itself. You also have the table's direction set to be "down", when I'm guessing you will want it to be "up" instead.

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Layout items up with UITable
« Reply #2 on: July 29, 2016, 11:48:35 AM »
I know there is UITextList, however it doesn't provides enough flexibility per message in my case (padding, animation...), this is why I preferred UITable and UILabels instead.

I am using Up at the moment, but as I said the elements are then in the wrong order so I am forced to insert them at the beginning.