Page 1 of 1

Chat box

Posted: Wed Aug 04, 2004 04:50
by CrazyEddie
Hi,

If the confirmation emails are not being sent, it must be a sourceforge oddity. If you email your details I should be able to manually set up your account.

There has been a bit of discussion about chat box style widgets. You could use a MultiLineEditbox in Read-only mode. Possibly your best bet is to use the Listbox for displaying the chat history and an edit box (obviously) for text entry. The basic Listbox text item provided does not word-wrap but it's a trivial thing to write a sub-class that does this.

Static text is due to get multi-line support shortly.

All widgets should work with default construction. Anything else is a bug :shock:

HTH

CE.

Chat box

Posted: Wed Aug 04, 2004 15:47
by Injector
Possibly your best bet is to use the Listbox for displaying the chat history


That's what I am doing and it works perfect!. Nice thing is that you can set every text line (i.e. listbox entry) to have a different text color, very handy for a console system (errors display red, warnings orange, infos grey, etc.), or maybe a chatbox? :D

Chat box

Posted: Wed Aug 04, 2004 17:47
by CrazyEddie
There are many powerful possibilities, especially if you think outside the (list)box a little (terrible pun, I know :roll:).

You could devise a new ListboxItem that allows you to have more than just a single item of text, and / or colours etc. This way, in a chat system, you can set the name of the player and the chat text for an item, have player names different colours, or whatever. With a tiny bit of effort, there's plenty of variations on what can be achieved, and basically that simple Listbox ends up being something entirely different. I guess the best advice is that you should not be afraid to experiment :)

Chat box

Posted: Wed Oct 27, 2004 18:34
by Emmeran
I like the idea of a listbox as a chatbox, because I can change the color of each row... but how can I disable the frame?

btw: is it anyhow possible to change the color of single parts of a line? If not, is it planned for future?

Chat box

Posted: Thu Oct 28, 2004 09:11
by CrazyEddie
Disabling the frame: This depends :) There's no actual method to disable the frame on a per-control basis at the moment, though if you want to disable the frame on all instances of the widget you could edit the imageset definition and/or image file. Antoher alternative is to copy the copy the code for the listbox widget and create a new version that doesn't draw a frame.

To have multiple colours in an item, you need to create your own ListboxItem based class. Within this class you can do anything you need to, including multiple colours. If I were to need such a thing, and say I wanted the name of the person speaking to be different from the actual chat text, what I would do is have an item with two separate strings; one for the name of the person and the other for the chat text. Then just render these with different colours. There are as many ways of doing this are there are programmers, it's a bit more work than having everything done for you, but it does give the programmer "ultimate power" ;)

CE.

Chat box

Posted: Thu Oct 28, 2004 10:00
by Emmeran
well I made a class with color

Code: Select all

class MyListItem : public CEGUI::ListboxTextItem
{
public:
   MyListItem(const CEGUI::String& text, CEGUI::colour color = CEGUI::colour(1,1,1)) : ListboxTextItem(text)
   {
      setSelectionBrushImage((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MultiListSelectionBrush");
      setTextColours(color);
   }
};


wasn't that difficult ;) but now that u said it is possible, I'll search the api, how to color single words best... thx!