Page 1 of 1

VertScrollPosition with StaticText

Posted: Thu Feb 28, 2008 19:31
by denreaper
I am attempting to make my chat window scroll to the newest message when a new message is received (hopefully only when the user isn't scrolling up, but that's something for later).

First I call:

Code: Select all

chat_area->setProperty( "VertScrollbar", "true" );


Then I call this line each time a new chat message is received:

Code: Select all

chat_area->setProperty( "VertScrollPosition", "1.0" );


However, an exception is thrown:

Code: Select all

Exception: There is no Property named 'VertScrollPosition' available in the set.


My widget type is TaharezLook/StaticText, which looking at it now, I guess it doesn't have this property listed under StaticText. Is there some way to get the scrollbar widget from my CEGUI::Window (which is a StaticText)?

Posted: Thu Feb 28, 2008 21:44
by Rackle
A different approach would be to use a ListBox. Have a look at GameChatBox, a working chat window that also supports multiple font sizes.

You should try to obtain a handle to the automatically created scrollbar and talk to it directly. Its "real" name is based on the name of your main widget. I think you are using a StaticText to display every message so the base name is the name of the StaticText. Appended to it is the special string "__auto_vscrollbar__". This special string can be found within datafiles/looknfeel/TaharezLook.looknfeel, within the section defining the StaticText.

Posted: Thu Feb 28, 2008 22:41
by denreaper
Thanks. This did the trick perfectly.