Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: roberto_sc on November 25, 2014, 01:22:57 AM

Title: Anchored Panel & UIGrid: What's the right way to use it?
Post by: roberto_sc on November 25, 2014, 01:22:57 AM
I'm trying to create a horizontal grid of buttons in a toolbar in the top of the screen, using 3.7.6.

I created an anchored panel to clip and contain this grid. The structure is exactly the same as the one found in example 7, except the panel is anchored.

Both panel and grid were created at 0,0,0.

What's the canonical way to make the UIGrid be drawn inside the clipping area? It's not being drawn there because the anchor in the panel changes the clipping area position and not the transform position.

The best way to achieve this was to check "Constrain to Panel" in UIGrid, but that doesn't work if I change the window size.

Thanks
Title: Re: Anchored Panel & UIGrid: What's the right way to use it?
Post by: ArenMook on November 25, 2014, 01:42:04 AM
Best way to go is to anchor a widget instead, and the panel would be a child of that widget. Also make sure the widget uses the top-left pivot. It will be much more predictable this way, as the grid is also top-left based.
Title: Re: Anchored Panel & UIGrid: What's the right way to use it?
Post by: roberto_sc on November 25, 2014, 02:21:55 AM
hmm yeah, thanks, that makes sense.

So the panel wouldn't be anchored, right? But then how can I make a clipping area that's variable according with the size of the screen?

I need this because the toolbar "stretches" to accommodate more buttons when the window gets wider.
Title: Re: Anchored Panel & UIGrid: What's the right way to use it?
Post by: ArenMook on November 26, 2014, 08:06:03 PM
Anchor the panel to the widget.