The colour about the selected brush image in ListboxTextItem

Help and discussion regarding skinning, themes, and other artistic content.

Moderators: CEGUI MVP, CEGUI Team

ogre2012
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Mar 23, 2011 07:55

The colour about the selected brush image in ListboxTextItem

Postby ogre2012 » Wed May 18, 2011 07:10

In the Sample_Demo7 project, there is some code as following:

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("Stage", "roundBack");
    }
};

I set the selectionBrushImage successfully.But found that the colour is so blue.And my image is red.
How to keep the image’s colour?
Can you help me?
Thank you very much!!!!!

ogre2012
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Mar 23, 2011 07:55

Re: The colour about the selected brush image in ListboxText

Postby ogre2012 » Wed May 18, 2011 07:28

ogre2012 wrote:In the Sample_Demo7 project, there is some code as following:

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("Stage", "roundBack");
    }
};

I set the selectionBrushImage successfully.But found that the colour is so blue.And my image is red.
How to keep the image’s colour?
Can you help me?
Thank you very much!!!!!


I have solved the problem.
--------------------------------------------------------------
setSelectionBrushImage("Stage", "roundBack");
CEGUI::colour c(1.0f, 1.0f, 1.0f, 1.0f);
setSelectionColours(c);
---------------------------------------------------------------------
But I met another problem.I need two images for the unselection items.Or set the two colours.
How to make it true?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: The colour about the selected brush image in ListboxText

Postby CrazyEddie » Sun May 22, 2011 08:37

When you need something more advanced than what is provided via the standard ListboxTextItem, the answer is to create a subclass - this enables you to use as many images and colours as you need :)

As an advanced example of such a subclass, there is a hack I made that allows you to use falagard xml skinning for your non-window based ListboxItems (with some limitations). This is described here: viewtopic.php?p=21975#p21975 but clearly you can do something simpler than this to achieve your goal :)

CE.


Return to “Skins and Themes”

Who is online

Users browsing this forum: No registered users and 4 guests