[Bug] GUILabel().Text color not changing.

Started by Razor., Mar 23, 2021, 05:57 PM

Previous topic - Next topic

Razor.

Description:
GUILabel().Text color not updating/reseting after text change.

Reproducible:
Always.

How to reproduce:

Label <- GUILabel();
Label.TextColour = Colour(255, 255, 255, 255);
Label.AddFlags(GUI_FLAG_TEXT_TAGS);
Label.FontFlags = GUI_FFLAG_BOLD;
Label.Text = "[#ff00ff]purple colored text";
//Example 2: "purple colored [#ff00ff]text";

After this, change the GUILabel().Text value:
Label.Text = "purple colored text";or
Label.Text = "purple colored[#ffffff0] text";Even putting a color or not, the text color will not change or will not change correctly.

I realized the test using a client-side /execc.

Mohamed Boubekri

#1
Actually, you can avoid that, like :-
Set the label null //// hide the label
label.label = null; //// like that
And after you set it null create it again and change the color.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

AdTec_224

It's not really a bug per se, MGUIs intended behaviour is to continue with the defined colour until you close the colour tag using '[#d]'. So to conform to what MGUI is looking for, it should be:

Label.Text = "[#ff00ff]purple colored text[#d]";
then when you change the text, you can just do:

Label.Text = "non-purple colored text";
and the line will be the default colour.

Hope this helps.