Few beginner questions

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

User avatar
chaosavy
Just popping in
Just popping in
Posts: 10
Joined: Tue Dec 28, 2010 19:39

Few beginner questions

Postby chaosavy » Tue Dec 28, 2010 19:49

First off many thanks for a great product and a great community. I've been using CEGUI (for the menus, hud and other functions) for a while as part of my Ogre project.

A vid: http://www.youtube.com/watch?v=c5muWiDzehE

Hopefully you all won't judge me too harshly for this one, but I can't figure it out and searched a bit for the answer. How
can I display the "/" aka forward slash character in a cegui widget (eg: static text)?

Also is there a way to force a re-draw of a widget? For example I have a list box with list box text items in it, they are color coded (eg: enemy is red and friendly is green) I want to sometimes change the color of the item if the status changes, so I call it up and set the color

Code: Select all

      
CEGUI::Listbox* listBox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().getWindow("Tactical/Targets/Tabs/Planets/ListBox"));
CEGUI::ListboxTextItem* itemListbox =static_cast<CEGUI::ListboxTextItem*>(listBox->findItemWithText(name, NULL));      
itemListbox->setTextColours(Library::getCEGUIFactionColor(faction));


However it doesn't re-draw the widget and thus doesn't change the color until I click on the widget (listbox), I suppose I could just delete all items and re-add them with the proper color, but I'm hoping there is some easier way to trigger a redraw or update.

thank you
Check out my space sim http://www.arrmaytey.com

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Few beginner questions

Postby Kulik » Tue Dec 28, 2010 19:58

1) forward slash ("/") shouldn't be a problem at all, I tried it and it works fine, could you post how you set it up? Problematic characters are \ (you have to escape it out in C++ - "something \\ something") or [ (it's used to mark up formatted text in CEGUI, you have to escape it like this - \[ in XML \\[ in C++ because you again have to escape the backward slash).

2) you can force a redraw via Window::invalidate() I think setTextColours should force a redraw, I will check it out.

EDIT: call invalidate on the listbox since the ListboxTextItem isn't a Window.
EDIT2: Look into ItemListbox, it contains ItemEntry instead of ListboxTextItem. Listbox and ListboxTextItem are going to be obsolete in 0.8 (I think and hope :wink: )

PS: It's insta help day today :lol:

User avatar
chaosavy
Just popping in
Just popping in
Posts: 10
Joined: Tue Dec 28, 2010 19:39

Re: Few beginner questions

Postby chaosavy » Tue Dec 28, 2010 20:31

thanks, the invalidate worked! Also since I knew that the / is supposed to work I investigated it and turns out that the font I was using was the problem (it looks like it doesn't include that character).
Check out my space sim http://www.arrmaytey.com


Return to “Help”

Who is online

Users browsing this forum: No registered users and 26 guests