help for tgui v0.7 listbox change text colors

Started by arturo.tramontini, 30 September 2015, 06:32:53

arturo.tramontini

    i have the following code:
   
   
   tgui::ListBox::Ptr listBox =  theme->load("ListBox");
    listBox->setPosition(10, 240);
    listBox->setSize(410-10, 420);
    listBox->setItemHeight(16);
    gui.add(listBox);
   
   
   how can i change TextColor Normal and Hover ?
   i see that there is a getRenderer()  and a ListBoxRenderer()
   but i'm not be able to use it because of my lack in knowledge of c++ syntax.
   
   if possible, can you help me with a little example for how change colors?
   (for example making normal text color black  and hover white)

arturo.tramontini

i try casually this code and it give me the result that i want:


listBox->getRenderer()->setTextColor(sf::Color::Black);


is it correct?

texus

Yep, that is indeed the code that you need.
The renderer always gets created together with the widget so you just have to call getRenderer to access it.