Hi all,
having browsed through the forum I realised the default font colour for listbox is white. However by using WindowsLook I am unable view any item in the listbox as the background is white as well. Is there anyway whereby I can change the font colour to perhaps black so that the items in the listbox is visible?
Thanks in advance.
WindowsLook: Fonts not visible in listbox
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
Have a look at ListboxTextItem::setTextColours.
The general advice here is not to use the generic ListboxTextItem class, but to sub-class it and provide your own specialised version which sets the text colour(s) and selection brush.
HTH
CE.
Have a look at ListboxTextItem::setTextColours.
The general advice here is not to use the generic ListboxTextItem class, but to sub-class it and provide your own specialised version which sets the text colour(s) and selection brush.
HTH
CE.
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Eddie beat me
(Since i was already preparing an answer, i'll post it anyway). The ListboxItem gets mapped in your scheme files to a Falagard/EntryItem, which has no properties. So you have to code such changes. As a sample i have added one line to the listboxitem of Sampe_Demo7.h to create red items:
Please note that this item gets also used in combo boxes and multi-column lists.
Maybe the PropertyDefinition parts in the looknfeel are obsoleted for the ListboxItem... Eddie?

(Since i was already preparing an answer, i'll post it anyway). The ListboxItem gets mapped in your scheme files to a Falagard/EntryItem, which has no properties. So you have to code such changes. As a sample i have added one line to the listboxitem of Sampe_Demo7.h to create red items:
Code: Select all
// Sample sub-class for ListboxTextItem that auto-sets the selection brush
// image. This saves doing it manually every time in the code.
class MyListItem : public CEGUI::ListboxTextItem
{
public:
MyListItem(const CEGUI::String& text) : ListboxTextItem(text)
{
setSelectionBrushImage("WindowsLook", "MultiListSelectionBrush");
setTextColours(0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000);
}
};
Please note that this item gets also used in combo boxes and multi-column lists.
Maybe the PropertyDefinition parts in the looknfeel are obsoleted for the ListboxItem... Eddie?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Well, there's another confusing point there, since from 0.5.0 we have two different approaches to Listbox widgets.
The old way, and which is to be considered deprecated once 0.5.0 final is out, is using the base widget class Listbox along with ListboxItem and ListboxTextItem classes for items which are created in code via the new operator.
Whereas the new and improved method is to use the ItemListbox system which makes use of EntryItem - this is better because it makes it possible to produce 'base' items which are skinned and also allows specification of list items in a Layout file. This is where, for example, "WindowsLook/ListboxItem" gets used, and in these cases the PropertyDefinitions will work as expected
Confused? I know I am
CE.
The old way, and which is to be considered deprecated once 0.5.0 final is out, is using the base widget class Listbox along with ListboxItem and ListboxTextItem classes for items which are created in code via the new operator.
Whereas the new and improved method is to use the ItemListbox system which makes use of EntryItem - this is better because it makes it possible to produce 'base' items which are skinned and also allows specification of list items in a Layout file. This is where, for example, "WindowsLook/ListboxItem" gets used, and in these cases the PropertyDefinitions will work as expected

Confused? I know I am

CE.
Who is online
Users browsing this forum: No registered users and 16 guests