ScrollToBottom Issues
by Jay Barnson · in Torque Game Engine · 06/05/2007 (12:57 am) · 2 replies
I've got a GuiScrollCtrl which contains a GuiMLTextCtrl.
So far so good.
The problem is that when I change the GuiMLTextCtrl's text field (another problem there... can only do it robustly with "setValue", not "setText"), and then immediately call the GuiScrollCtrl's "scrollToBottom()" function, nothing happens. I'm still auto-scrolled at the top.
Now, once the screen has updated, if I manually call scrollToBottom() via the console, it behaves properly. But apparently it waits until display time to recalculate the extents or something.
Anybody know a fix or work-around for this problem?
EDIT:
I did a work-around by adding a delay to the call to scrollToBottom command, so that it's been guaranteed to have displayed (and updated its size) first, but that's really lame, and you can see the text jump after a split second. Is there any way to force it to update its size before it gets displayed? It seems strange that there wouldn't be...
So far so good.
The problem is that when I change the GuiMLTextCtrl's text field (another problem there... can only do it robustly with "setValue", not "setText"), and then immediately call the GuiScrollCtrl's "scrollToBottom()" function, nothing happens. I'm still auto-scrolled at the top.
Now, once the screen has updated, if I manually call scrollToBottom() via the console, it behaves properly. But apparently it waits until display time to recalculate the extents or something.
Anybody know a fix or work-around for this problem?
EDIT:
I did a work-around by adding a delay to the call to scrollToBottom command, so that it's been guaranteed to have displayed (and updated its size) first, but that's really lame, and you can see the text jump after a split second. Is there any way to force it to update its size before it gets displayed? It seems strange that there wouldn't be...
About the author
Jay has been a mainstream and indie game developer for a... uh, long time. His professional start came in 1994 developing titles for the then-unknown and upcoming Sony Playstation. He runs Rampant Games and blogs at Tales of the Rampant Coyote.
#2
11/02/2010 (10:19 pm)
Heh - well, I went with a different approach to save my sanity, but I do appreciate the answer.
Torque Owner Paul Ash
ChatWindow.forceReflow();
ChatWindow.scrollToBottom();
Hope it helps anyone out who might have hit this thread. I know I did and was frustrated to not have an answer, but I figured it out!