Page 1 of 1

Listbox doesn't highlight the selected item

Posted: Tue Aug 09, 2016 08:59
by FrancescoLasa
Hi,
I create a listbox and I add some items:

Code: Select all

Listbox*listbox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Listbox", "levels listbox"));
CEGUI::ListboxTextItem*item = new CEGUI::ListboxTextItem("text");
listbox->addItem(item);

I see in many post that before add the items at the listbox I can set the selection color and the selection brush image for select the items when i click on it, the problem is that in every post the setSelectionBrushImage() use two CEGUI::String like parameters, but in my version of CEGUI (0.8.7) the methods use only one parameter and so I don't know what I have to use here:

Code: Select all

item->setSelectionColours(CEGUI::Colour(255, 0, 0, 255));
item->setSelectionBrushImage(?);

Re: Listbox doesn't highlight the selected item

Posted: Tue Aug 09, 2016 09:36
by YaronCT
@FrancescoLasa: It gets one parameter - the name of the image.

Re: Listbox doesn't highlight the selected item

Posted: Tue Aug 09, 2016 18:51
by Ident

Re: Listbox doesn't highlight the selected item

Posted: Thu Aug 18, 2016 11:46
by FrancescoLasa
Ok thank you, I fix it. If someone has the same problem..
I create a new ImageSet which contain a very basilar imageSet element,

Code: Select all

<Imageset autoScaled="true" imagefile="Immagine.png" name="Sfondi" nativeHorzRes="800" nativeVertRes="600" version="2">
    <Image autoScaled="horizontal" height="29" name="sfondo1" width="175" xPos="0" yPos="0" />
</Imageset>

then i load the image set in the program

Code: Select all

CEGUI::ImageManager::getSingleton().loadImageset(imageSetPath);

and I set it for the ListBoxTextItem

Code: Select all

Listbox*listbox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Listbox", "levels listbox"));
CEGUI::ListboxTextItem*item = new CEGUI::ListboxTextItem("text");
item->setSelectionColours(CEGUI::Colour(255, 0, 0, 255));
item->setSelectionBrushImage("Sfondi/sfondo1");
listbox->addItem(item);

Re: Listbox doesn't highlight the selected item

Posted: Thu Aug 18, 2016 12:43
by YaronCT
@FrancescoLasa: You don't have to use an image set - u can also use "ImageManager::addFromImageFile".

Re: Listbox doesn't highlight the selected item

Posted: Fri Aug 19, 2016 10:42
by FrancescoLasa
Great! So the code is more clear and simple..Thank you very much :)

Re: Listbox doesn't highlight the selected item

Posted: Fri Aug 19, 2016 10:44
by YaronCT
NP :D