How do I change the texture of the scrollbar components in a ChatBox?

  • 2 Replies
  • 52 Views
*

pbortler

  • *
  • 5
  • Where's the fucking documentation!?!?!
    • View Profile
I can't seem to get any kind of ScrollbarRenderer from the ChatBox or the ChatBoxRenderer. I can get a RenderData object, but I can't make any use of it. Creating a ScrollbarRenderer, passing ChatBox->getRenderer()->getScrollbar() into its setData(), modifying the background texture, and using the modified ScrollbarRenderer's getData() for ChatBox->getRenderer()->setScrollbar() has no effect.

That was just a guess though, since guessing is the best I can do with no useful documentation or examples.

So what's the trick to getting access to a ChatBox ScrollbarRenderer?
Where's the fucking documentation!?!?!

*

texus

  • *****
  • 1584
    • View Profile
    • Texus's Blog
Re: How do I change the texture of the scrollbar components in a ChatBox?
« Reply #1 on: 10 September 2020, 18:59:36 »
This is indeed undocumented.

Quote
passing ChatBox->getRenderer()->getScrollbar() into its setData(), modifying the background texture, and using the modified ScrollbarRenderer's getData() for ChatBox->getRenderer()->setScrollbar() has no effect.
That should have worked actually. Was the scrollbar already using textures? Because a known "issue" with the scrollbar is that it has to be given textures for track, thumb and arrows or it would use colors for everything. So if you only changed one texture while the others are still colors then it won't use the texture. That issue has recently been resolved in 0.9-dev though.

The WidgetRenderer constructor can be given the RenderData as parameter, then you can skip the setData call:
tgui::ScrollbarRenderer renderer(ChatBox->getRenderer()->getScrollbar());
renderer.setTrackColor(tgui::Color::Red);
ChatBox->getRenderer()->setScrollbar(renderer.getData());
« Last Edit: 10 September 2020, 19:04:49 by texus »

*

pbortler

  • *
  • 5
  • Where's the fucking documentation!?!?!
    • View Profile
Re: How do I change the texture of the scrollbar components in a ChatBox?
« Reply #2 on: 10 September 2020, 19:07:29 »
That should have worked actually. Was the scrollbar already using textures? Because a known "issue" with the scrollbar is that it has to be given textures for track, thumb and arrows or it would use colors for everything.

This was the issue. Changing all the necessary textures worked. Thanks.
Where's the fucking documentation!?!?!