GUITreeView and GUIScrollArea backgrounds


#1

Hi,
I am trying to change the background of the following graphical element GUITreeView and GUIScrollArea. I checked in GUIScrollArea and the parameter const String& scrollAreaStyle is unused. As for GUITreeView changing the background style does not work. It is set up to mBackgroundStyle = "TreeViewBackground"; by default but changing the image does not work at all, the texture mBackgroundImage is never shown.
This is the first time I dig into GUI elements so I might have misunderstood something.

Any ideas ?


#2

Backgrounds need to be set up as separate GUI elements (i.e. GUITexture) that are then placed behind other GUI elements.

This can be done by setting up two separate GUIPanels with different depths. One is the main panel on which you add GUIScrollArea, and another is an “underlay” panel on which you can add GUITexture.

For an example you can take a look at this helper code I use in the editor: https://github.com/BearishSun/BansheeEngine/blob/master/Source/EditorManaged/GUI/GUILayoutWithBackground.cs

It’s C#, but should be easy to translate to the C++ equivalent. As the name implies, it creates a GUILayout onto which you can add some GUI elements to, and a background image that will render behind anything on the layout.


#3

Works like a charm, thanks for your help.