[Solved] Button caption text color not sticking...

ZealAddon

18-02-2010 21:34:33

Using 3.0.0 - I set the caption text color for my button...
button->setCaption("exit");
button->setTextColour(MyGUI::Colour::White);


But as soon as I hover over the button the text color reverts back to its default (black). Edit boxes do NOT seem to have this problem, only buttons.

Also, is there anyway to change the text color of highlighted text? When highlighting text with the core_blue_black skin, the highlighted text is black, which makes it very difficult to read :(.

my.name

19-02-2010 09:12:10

button->setCaption("0xFFFFFFexit");

ZealAddon

19-02-2010 14:44:59

Does not work for me :( it sets the caption to "0xFFFFFFexit". I am using 3.0, is this a new 3.0.1 feature?

In any case, thats a pretty ugly syntax dont you think? Shouldnt there just be a dedicated 'setCaptionColor()' method?

*Ah I think you meant "button->setCaption("#FFFFFFexit");", THAT seems to work great :)! Still think the syntax would be more intuitive if there was just a setCaptionColor() method.

Altren

19-02-2010 19:46:16

The trick is that you can write:button->setCaption("#FF0000Red #00FF00Green #0000FFBlue");in single piece of text.
And about setTextColour - it was resetting text because button have possibility to have different text colours in different states, so it was setting another colour when you was hovering over it. Adding setCaptionColor function may confuse users even more.

ZealAddon

19-02-2010 20:43:06

Yeah I guess the ability to have different words be different colors is nice. However on the flip side - if you want to read back that string, you have to strip out all of the hex values.

Maybe getCaption (and other 'get string' methods) could have an option to search the string for color values and remove them before return? Just as a convenience function.

Altren

19-02-2010 22:46:29

Usually caption is just visual representation of something. If you really want to store some strings in widget you can try
button->setUserString("MyData", "Very important string");
//and
button->getUserString("MyData");


[Edit]
Oh, right! TextIterator::getOnlyText(button->getCaption());

ZealAddon

20-02-2010 16:51:38

TextIterator::getOnlyText

Haha looks like youre always one step ahead!