Welcome,
Guest
. Please
login
or
register
.
April 28, 2026, 07:34:50 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Automatically scroll to end of view
« previous
next »
Print
Pages: [
1
]
Author
Topic: Automatically scroll to end of view (Read 4021 times)
kruncher
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Automatically scroll to end of view
«
on:
October 20, 2013, 11:08:08 AM »
I have a scroll panel with a vertical scrollbar which contains a simple label. The label is updated throughout game play.
How can I automatically scroll to the end as text is appended?
if
(
logLabel
.
text
==
""
)
logLabel
.
text
=
message
;
else
logLabel
.
text
+=
"
\n
"
+
message
;
// automatically scroll to end.
// Does not work :(
logScrollbar
.
value
=
1f
;
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Automatically scroll to end of view
«
Reply #1 on:
October 20, 2013, 06:08:23 PM »
UIDraggablePanel.SetDragAmount
Logged
kruncher
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Re: Automatically scroll to end of view
«
Reply #2 on:
October 20, 2013, 06:21:46 PM »
This is almost working:
if
(
logLabel
.
text
==
""
)
logLabel
.
text
=
message
;
else
logLabel
.
text
+=
"
\n
"
+
message
;
// Automatically scroll to end.
logScroller
.
SetDragAmount
(
0
,
1
,
false
)
;
It scrolls to the entry before the latest.
Log
(
"A"
)
;
Log
(
"B"
)
;
Log
(
"C"
)
;
Log
(
"D"
)
;
// This one is at the bottom
Log
(
"E"
)
;
// Need to manually scroll to see this fellow!
Any ideas?
Logged
kruncher
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Re: Automatically scroll to end of view
«
Reply #3 on:
October 20, 2013, 06:29:14 PM »
Side Note: Passing "true" in to update the scrollbars causes the entire scroll panel to shift downwards (like when scroll scale is set to 0).
Logged
kruncher
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Re: Automatically scroll to end of view
«
Reply #4 on:
October 20, 2013, 06:32:55 PM »
Calling "UpdateScrollbars" manually seems to resolve my issue though:
// Automatically scroll to end.
logScroller
.
UpdateScrollbars
(
true
)
;
logScroller
.
SetDragAmount
(
0
,
1
,
false
)
;
Thanks for pointing me in the direction of SetDragAmount!!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Automatically scroll to end of view