[Bug] Changing the color of a parent window causes child label to disappear

Started by EK.IceFlake, Jun 09, 2017, 09:35 AM

Previous topic - Next topic

EK.IceFlake

Description
I have some code:
class IInventoryTab
{
    Container    = null;

    Item         = null;
    Value        = null;

    constructor (parent, position_reference = null, item = "", value = "")
    {
        local _this = this;

        this.Container    = GUIWindow(VectorScreen(0, 0), VectorScreen(280, 32), Color(0, 0, 0, 0))
            .CRemoveFlags(GUI_FLAG_SCROLLABLE | GUI_FLAG_WINDOW_TITLEBAR | GUI_FLAG_WINDOW_CLOSEBTN | GUI_FLAG_WINDOW_RESIZABLE | GUI_FLAG_SHADOW | GUI_FLAG_BORDER)
            .CAddFlags(GUI_FLAG_MOUSECTRL)
            .SetParent(parent)
            .On("HoverOver", function () { _this.Container.Color = Color(255, 255, 255, 192); })
            .On("HoverOut", function () { _this.Container.Color = Color(0, 0, 0, 0); });
       
        if (position_reference != null) this.Container.Insert(InsertLocation.Below, position_reference);
       
        this.Item         = GUILabel(VectorScreen(0, 0), Color(200, 200, 200), item)
            .SetParent(this.Container)
            .SetTypeface("lato", 11, Color(200, 200, 200))
            .Float(FloatLocation.CenterLeft)
            .Offset(VectorScreen(8, 0));
       
        this.Value        = GUILabel(VectorScreen(0, 0), Color(200, 200, 200), value)
            .SetParent(this.Container)
            .SetTypeface("lato", 11, Color(200, 200, 200))
            .Float(FloatLocation.CenterRight)
            .Offset(VectorScreen(-8, 0));
    }
}

Whenever I hover over the window it becomes white but the label disappears. It's not cammoflauged because when I hover out it becomes transparent again but this time the label isn't visible.
If I comment the part of the code that changes the window's color, the label doesn't disappear:
            .On("HoverOver", function () { /*_this.Container.Color = Color(255, 255, 255, 192);*/ })
            .On("HoverOut", function () { /*_this.Container.Color = Color(0, 0, 0, 0);*/ });

Reproducible
Always :(

What you were doing when the bug happened
Making a window that changes its color on hover

What you think caused the bug
Incomplete rerendering

:edit: Another bug report claimed it was it applying its alpha to all its children. That was the case and a workaround for anyone who is frustrated by this is to recolor all children after setting its color.