VertScrollPosition with StaticText

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

denreaper
Just popping in
Just popping in
Posts: 7
Joined: Wed Feb 27, 2008 06:07

VertScrollPosition with StaticText

Postby denreaper » Thu Feb 28, 2008 19:31

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)?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Thu Feb 28, 2008 21:44

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.

denreaper
Just popping in
Just popping in
Posts: 7
Joined: Wed Feb 27, 2008 06:07

Postby denreaper » Thu Feb 28, 2008 22:41

Thanks. This did the trick perfectly.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests