Page 1 of 1

Custom Combobox

Posted: Sat Feb 24, 2007 17:08
by VenusBlue
Hi. I've been searching the forums for over an hour now trying to find a working solution to my problem, and yet I still haven't.

I have a custom imageset and a Falagard based LookNFeel file.

I'm trying to use a Combobox, which shows up great, and works fine. I am adding ListboxTextItems, creating them dynamically and adding them to the combobox window. I read somewhere that the default text is white (which was also the color of my background) so I tried changing the text color. I then read that you cannot change the text color, but rather have to inherit from ListboxTextItem to change the color. Before doing this, I changed the background to a dark color, and I still see no text. Here's an example of what I am doing:

Code: Select all

//I get my Combobox from the xml layout in the constructor
combobox->setReadOnly(true);

CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem("1");
item->setSelectionBrushImage("CustomImageset", "image");
item->setTextColours(CEGUI::ColourRect(CEGUI::colour(0.0f, 0.0f, 0.0f, 1.0f)));

combobox->addItem(item);


Is there anything else I have to do to make the ListboxTextItems show up?

Posted: Sat Feb 24, 2007 19:35
by scriptkid
Hi,

what is your exact background colour now? Can you try to remove the call to setTextColours? Then you should at least have a white text. Changing text colours should work, i just verified with sample7...

Good luck!

Posted: Mon Feb 26, 2007 16:26
by VenusBlue
Thanks for replying so quickly! I tried just not setting the color of the text at all, and I still see no text at all, not even white. The background is now a dark gray so I should be able to see it. Do you think it might have something to do with my imageset? Or maybe the image that I'm setting in setSelectionBrushImage ? And you should be able to add ListboxTextItems to a combobox, because I saw that in several other examples, right?

Thanks so much!

Vanessa

Posted: Tue Feb 27, 2007 09:14
by scriptkid
Hi,

okay i see. I am not sure how an imageset could cause problems. Note that the selectionBrushImage is only used when you select the item. Do you see a difference when you select an item? Are you sure that the items are in the box? Does GetItemCount() return a value? Is your combobox high enough to show any items? Can you see text in the editbox-part of the combobox? Just some random questions ;-)

Posted: Tue Feb 27, 2007 21:07
by VenusBlue
I don't see any differences when I select items, there's not really any items there to select, but I don't even see like my selection image appearing. It's weird, I can set an item as selected in the code using setSelected and then get selectedItem in my combobox and it will display it. However, I just see nothing in my item list in the drop down box. It's almost like they are there, but not visible. I am making sure the combobox is on top and well, it's obviously visible. Is there a way to give the ListboxTextItem a position, or to tell it to be visible? It seems like it could be rendering outside of my window or something.

I really do appreciate all your help! This is so weird!

Posted: Thu Mar 08, 2007 18:19
by scriptkid
Hi again,

this trick might help you:
http://www.cegui.org.uk/phpBB2/viewtopi ... highlight=

Posted: Tue Mar 20, 2007 16:12
by VenusBlue
I solved my problem!!!!!!!!!! The problem was I had an image that was actually covering up the items in my looknfeel file. I changed the droplist images to be smaller (10 pixels instead of like huge) and you could see the items, imagine that! hahahah Pretty simple really, I'm mad it took me so long to figure it out. I was able to look at the Taharez looknfeel file to figure that out. Thanks for all your help I really appreciate it! (oh and the text is black like I want!)