Author Topic: How can i anchor a UIPanel ?  (Read 5077 times)

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
How can i anchor a UIPanel ?
« on: November 19, 2014, 06:29:33 AM »
I'm using NGUI 3.7.1 ( And not allowed to update at the moment ).
When i want to anchor some object i add an Anchor to it's sprite, label etc... and if there is nothing there i'm adding a widget. The problem is, UIPanel's anchor doesn't have the same behavior like the normal anchors. So the question is, is it ok to put an extra UIWidget to apply the anchor on it? will it mess things up as far as the alpha and other properties goes ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How can i anchor a UIPanel ?
« Reply #1 on: November 19, 2014, 03:48:43 PM »
UIAnchor is a legacy component. It shouldn't be used anymore. Stick to the built-in anchoring system.

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: How can i anchor a UIPanel ?
« Reply #2 on: November 20, 2014, 02:06:14 AM »
I was talking about the built in system.
I add a widget so i can use it's anchor.
But the anchor on the panel works differently.

slumtrimpet

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 13
    • View Profile
Re: How can i anchor a UIPanel ?
« Reply #3 on: November 20, 2014, 12:04:23 PM »
If you turn on soft-clipping on the panel it has the normal anchoring features doesn't it?  I'm kinda curious on the answer to this too, but my experience is that the panel by default is 'full screen' with no anchor settings needed or available but as soon as you turn on soft-clip you get the normal anchor options just like an object with a UIWidget.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How can i anchor a UIPanel ?
« Reply #4 on: November 20, 2014, 08:54:19 PM »
Panel must have some clipping type other than "none" for it to actually have a rectangle to work with, and by association -- anchoring functionality.

Otherwise a panel is just a boundless object that merely collects and draws widgets.

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: How can i anchor a UIPanel ?
« Reply #5 on: November 23, 2014, 02:28:53 AM »
Yes but i can't anchor the panel to an other panel, if i do so, it won't move with it, it will just change it's rec and there for will move it's anchored children but won't move the anchor position like it would in a normal widget.