I’m creating a lemur button style - and I have three different background images that I want to use for “normal”, “clicked” and “hover” states. At the moment though the only option I see inside the button object is to set a hightlight colour which changes the text.
Have I missed something or is there no way to do this with swapping textures?
On a related note these buttons contain no text (one reason the highlight colour is no use!) but there seems to be no way to create a button without it creating all the un-needed (in this case) bitmap text objects. Is that right or did I miss something?
Effect is related to the animation system. Command is a general way of adding hooks to a button. You could also have used an effect in this case. I don’t know off the top of my head how to set it through styling and I thought that’s what you were asking at first… so I went with the one I know works.
Edit: effects are nice especially for concepts like up/down highlight/unhighlight because they have a built in concept of things that are the reverse of another thing. But Buttons give us options because they keep the state anyway.
If I don’t clone() the QuadBackgroundComponent every time it vanishes after the first time it is displayed!
i.e. the button displays, then when I hover over it the hover displays, but then when I move off it the original never comes back and we end up with an empty space!
If you don’t clone it then it’s shared with all of the other ones… the next time you add it to something else then it will disappear from the others.
Styling normally takes care of the cloning for you but it can’t when you are setting it directly like that.
You may be better off in the long run creating an actual listener class that can hold references… but I can’t remember if the action commands are also cloned (I think they are but I’m not sure).
Yeah. It’s not ideal having to constantly clone it instead of cycling through the same 3 per component.
Not worth trying to optimise though I think. The extra complexity would be a lot for the small gain.