Author Topic: Anchoring group of widgets in new layout system  (Read 3663 times)

chufraise

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Anchoring group of widgets in new layout system
« on: February 04, 2014, 09:36:54 AM »
Hi,
I'm struggling to understand the new layout system. I've looked at all the videos but the solution to my problem is not represented there. Basically I'm trying to group a bunch of widgets and anchor them in the top left of the screen.

I put five buttons as children to a Panel. I set the the Panel to "Constrain But Don't Clip" just to enable the Anchors-section. Then I chose Unified as anchors type. To anchor the Panel I set the target to UIRoot and the values to
  1. Left = Target's left
  2. Right = Target's left
  3. Bottom = Target's top
  4. Top = Target's top
  5.  

Now, I thought that should be sufficient. But when I change the aspect ratio the panel the panel get's anchored right, but buttons doesn't go along with the parented panel. They're not anchored for some reason.

I can enable the Anchors on every individual widget but that's a bit of a hazzle, and I don't think that's the intended practice.

In the old layout system I just added an anchor-script and set the alignment on the widget container and that was that.

Can anyone tell me what I'm doing wrong?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring group of widgets in new layout system
« Reply #1 on: February 05, 2014, 04:28:47 PM »
Panel can't have anchoring defined unless the panel has a clipping rect. In the latest version of NGUI, the anchor option is flat out disabled on panels that don't have clipping turned on.

Use a widget container instead. ALT+SHIFT+W, position the widget where you need it to be, anchor it. All your buttons will be children of this widget, and don't need to be anchored.

chufraise

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Anchoring group of widgets in new layout system
« Reply #2 on: February 06, 2014, 03:29:28 AM »
Thanks Mister!