Author Topic: UIDragPanelContents and some NGUI Event SendMessage problem  (Read 5958 times)

N3uRo

  • Guest
UIDragPanelContents and some NGUI Event SendMessage problem
« on: April 13, 2012, 03:19:33 PM »
Aren I don't understand why you scroll the UIPanel and not the content. It doesn't make sense.

Any scroll you see (in any language), it's the content what scrolls.

When I use UIDragObject it's the content what scrolls (the correct behaviour) and I have been using it for a while with no problems at all. But with UIDragPanelContents you change the transform and the clipping coordinates of the UIPanel, so If I want to swap between GameObjects that act as "pages" I have the problem that because the panel has the transform modified it doesn't show the "page" from the beginning (Y = 0).

Sorry If my explanation was not clear.

An speaking of events I don't understand either two events behaviour:

UICheckbox: Why you pass "bool checked" as param? Why not the sender? If you want to listen to one checkbox it's ok but if you want more than one you don't know which it was. I know that it's easier to pass the flag and not the sender because then you need to get the component each time but in some cases it could be necessary.

UIInput: The same problem, in this case it doesn't have parameters.

My situation is that in my project I have a checklist with so many checkbox and inputs so I need to know which is which that triggers each event.

Keep working!!!!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragPanelContents and some NGUI Event SendMessage problem
« Reply #1 on: April 13, 2012, 03:21:23 PM »
Because when you move the content, ALL the widget buffers need to be re-created from scratch. When you adjust the panel's position and its clipping, all that changes is the matrix that gets sent to the shader, which is far faster and more efficient.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragPanelContents and some NGUI Event SendMessage problem
« Reply #2 on: April 13, 2012, 03:22:32 PM »
And btw, you can manually reset the panel's offset: UIDraggablePanel.ResetPosition().

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragPanelContents and some NGUI Event SendMessage problem
« Reply #3 on: April 13, 2012, 03:24:10 PM »
In regards to the UICheckbox, that's for convenience. You can always get the checkbox itself via UICheckbox.current.

Same thing with UIInput: UIInput.current.

N3uRo

  • Guest
Re: UIDragPanelContents and some NGUI Event SendMessage problem
« Reply #4 on: April 13, 2012, 03:33:18 PM »
Ok, thanks for all! I didn't know any of this!! I read the source code always to learn more on NGUI but I didn't saw that static variables.