help for tgui v0.7 listbox change text colors
« on: 30 September 2015, 06:32:53 »
    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)

Re: help for tgui v0.7 listbox change text colors
« Reply #1 on: 30 September 2015, 07:58:01 »
i try casually this code and it give me the result that i want:


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


is it correct?

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: help for tgui v0.7 listbox change text colors
« Reply #2 on: 30 September 2015, 11:12:01 »
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.