Welcome,
Guest
. Please
login
or
register
.
January 22, 2025, 11:11:03 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
How to: Set UIDraggablePanel Position
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to: Set UIDraggablePanel Position (Read 4007 times)
InfiniteAmmo
Guest
How to: Set UIDraggablePanel Position
«
on:
April 16, 2012, 05:23:32 PM »
So I have a UILabel in a panel that I'm filling up with text. This is for a game that simulates having an email inbox, and the UILabel gets more and more text as your email thread accumulates.
I'm using UIDraggablePanel to move the view, but I don't know how to set it to the "bottom" of the viewable area to show the latest text as it comes in.
Setting the Panel's localPosition seems to break everything.
Any ideas? :O Thanks!
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: How to: Set UIDraggablePanel Position
«
Reply #1 on:
April 16, 2012, 10:08:51 PM »
UIDraggablePanel.SetDragAmount(0, 1); <-- this will move the clipped area to the left (0) and bottom (1) -- basically the bottom left corner. If you wanted it to be just bottom, you'd specify (0.5, 1).
Logged
InfiniteAmmo
Guest
Re: How to: Set UIDraggablePanel Position
«
Reply #2 on:
April 18, 2012, 03:33:52 PM »
Thanks!
There was one extra step, but I got it working...
uiDraggablePanelMessage
.
UpdateScrollbars
(
true
)
;
uiDraggablePanelMessage
.
SetDragAmount
(
0
.
0f, 1
.
0f,
true
)
;
Had to call UpdateScrollbars to force it to recalculate the bounds. (because text is added to the UILabel inside the panel in the same function)
It might make more sense if there was a RecalculateBounds() function I could call?
The boolean parameter at the end of SetDragAmount basically means "should SetDragAmount call UpdateScrollbars(false) at the end."
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: How to: Set UIDraggablePanel Position
«
Reply #3 on:
April 18, 2012, 08:32:37 PM »
There is a ResetPosition() function that will do what you want. It uses "relativePositionOnReset" as its position.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
How to: Set UIDraggablePanel Position