Author Topic: Anchored Panel & UIGrid: What's the right way to use it?  (Read 5413 times)

roberto_sc

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Anchored Panel & UIGrid: What's the right way to use it?
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchored Panel & UIGrid: What's the right way to use it?
« Reply #1 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.

roberto_sc

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
Re: Anchored Panel & UIGrid: What's the right way to use it?
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchored Panel & UIGrid: What's the right way to use it?
« Reply #3 on: November 26, 2014, 08:06:03 PM »
Anchor the panel to the widget.