Author Topic: UIDraggablePanel - Multiple Lines?  (Read 5681 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
UIDraggablePanel - Multiple Lines?
« on: June 27, 2012, 03:14:27 AM »
When clicking on the Reposition Now Button, the list is repopulated into a single line. Is there anyway to have this list repositioned into 2 or 3 lines instead of just 1?

I had the idea of creating multiple Panels that could be scrolled with just 1. However that puts lots of complications in, such as having to populate 3 lists instead of 1, not to mention having to have 3 sets of duplicated panel data.

Has anyone else any experience of multiple line Draggable Panels?

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #1 on: June 27, 2012, 04:37:35 AM »
Hi,

I guess you're using a UIPanel and UITable for that right ?

In my case, I have a SubPanel containing a UIPanel, with clipping set to Soft Clip for example, and here I can define the size of the clipping.
And everything should be restrained to the size you set here.

Maybe it's absolutely not what you're talking about, but give it a try :)

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #2 on: June 27, 2012, 05:20:39 AM »
Also, make sure "Restrict Within Panel" checkbox is checked on UIDraggablePanel.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #3 on: June 27, 2012, 06:11:41 AM »
Aah, yes. Thanks nahoY. I wasn't using UIPanel but now that I am, it seems to be just what I was looking for. Although annoyingly I only have Direction "Up" and "Down" when it want it to go right...

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #4 on: June 27, 2012, 06:23:21 AM »
Hum, maybe you should look at the example 7 - Scroll View (Panel) form the NGUI Examples :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #5 on: June 27, 2012, 07:02:55 AM »
Quote
When clicking on the Reposition Now Button, the list is repopulated into a single line. Is there anyway to have this list repositioned into 2 or 3 lines instead of just 1?
UIGrid.columns
UITable.columns

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #6 on: June 27, 2012, 07:12:34 AM »
Hi guys, thanks for all the advice. In the end I got it working, the crap way.
I rotated the whole UIGrid by 90 degrees so it scrolls to the right. And the first (and only) object that I will duplicating I rotated -90 degrees.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #7 on: June 27, 2012, 10:25:55 AM »
... o_O

Why?

Direction of scrolling is determined by the "scale" value on UIDraggablePanel. X = 1 means along X. Y = 1 means along Y. -1 means inverse. 0 means won't be scrollable.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #8 on: June 27, 2012, 09:39:35 PM »
I am not having a problem with the scrolling, it is the positioning of the sprites in the first place.

I've taken out the -90 and 90 but I still can't get it to format correctly. It only goes up or down.

If there was simple an option for Direction = Right instead of just Up and Down then everything would work ok.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #9 on: June 27, 2012, 10:14:55 PM »
Direction right? Up or down? I think I'm missing something.

By default the grid's items are added to the right of the previous, in a single line. If the number of specified columns is reached (maxPerLine), a new row is started. If you set the number of columns to '1', it will be going down instead of right.

That's all assuming the direction is set to "horizontal".

If you change the direction to "vertical", it's the same thing, but with Y and X flipped, basically. Instead of extending toward the right, it will extend downward. "maxPerLine" becomes number of rows instead of columns, and if this number is reached, a new column gets started (to the right of the first one).

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #10 on: June 27, 2012, 10:29:57 PM »
If I use max per line it certainly does populate them into multiple rows, the problem is then it lists them as a whole row before going onto the next line, where I want it to populate them going down the page. I can get the exact behaviour I want using that 90 and -90 hack thing.

Looking at UITable it seems unusual (to me anyway) to be able to specify the number of Columns, but then the Direction is only Up and Down. It should surely be Left or Right.

Or the opposite, Rows :
and then Direction Up and Down.

I know in your previous post you mentioned "UIGrid.columns" but I don't see a columns box in that script.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel - Multiple Lines?
« Reply #11 on: June 28, 2012, 04:49:04 AM »
I meant UIGrid.maxPerLine. UITable is the one that has 'columns' property. Technically the latter should also be renamed to "maxPerLine".