Author Topic: Centered Grids and Tables  (Read 4264 times)

BrightBit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 21
    • View Profile
Centered Grids and Tables
« on: June 24, 2014, 03:37:37 AM »
Hi,

How can I center a table or a grid in the middle of a screen or in the middle of a widget? Is there a way to change the pivot of a table from "top left" to "center"?


Greetings
BrightBit

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Centered Grids and Tables
« Reply #1 on: June 24, 2014, 04:55:20 AM »
No, table doesn't have a pivot. Only the grid does. You can reposition the table via code by using NGUITools.CalculateRelativeWidgetBounds to determine the bounds of the table, and then off-setting its position by half of its width and/or height.

BrightBit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 21
    • View Profile
Re: Centered Grids and Tables
« Reply #2 on: June 24, 2014, 06:08:53 AM »
A bit unintuitive but it worked. Thank you. :)