Listbox doesn't highlight the selected item

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

FrancescoLasa
Just popping in
Just popping in
Posts: 3
Joined: Mon Aug 08, 2016 16:55

Listbox doesn't highlight the selected item

Postby FrancescoLasa » Tue Aug 09, 2016 08:59

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(?);

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Listbox doesn't highlight the selected item

Postby YaronCT » Tue Aug 09, 2016 09:36

@FrancescoLasa: It gets one parameter - the name of the image.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Listbox doesn't highlight the selected item

Postby Ident » Tue Aug 09, 2016 18:51

CrazyEddie: "I don't like GUIs"

FrancescoLasa
Just popping in
Just popping in
Posts: 3
Joined: Mon Aug 08, 2016 16:55

Re: Listbox doesn't highlight the selected item

Postby FrancescoLasa » Thu Aug 18, 2016 11:46

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);

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Listbox doesn't highlight the selected item

Postby YaronCT » Thu Aug 18, 2016 12:43

@FrancescoLasa: You don't have to use an image set - u can also use "ImageManager::addFromImageFile".

FrancescoLasa
Just popping in
Just popping in
Posts: 3
Joined: Mon Aug 08, 2016 16:55

Re: Listbox doesn't highlight the selected item

Postby FrancescoLasa » Fri Aug 19, 2016 10:42

Great! So the code is more clear and simple..Thank you very much :)

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Listbox doesn't highlight the selected item

Postby YaronCT » Fri Aug 19, 2016 10:44

NP :D


Return to “Help”

Who is online

Users browsing this forum: No registered users and 18 guests