I have a question regarding how images are displayed in DirectFrames.
I am using many DirectFrames as buttons to create a menu and submenus. Everything works perfectly, but I want to add icons on each DirectFrames, and that’s the moment were things get a little spicy!
Everything is triggered by DGG.WITHIN and DGG.WITHOUT:
Before I get to the main question, may I ask: Why is it that you’re not using DirectButtons? Is there some functionality that doesn’t work with them…?
In any case, returning to the actual question, this seemed at first odd.
You see, testing quickly on my end, I find that the “frameColor” value tints images added via the “frameTexture” keyword-parameter, but not images added via the “image” keyword-parameter.
However, looking closer at your code, it seems to me that you’re not actually using the “frameColor” value! You’re instead calling the “setColor” method, which is a method available to NodePaths in general (not just DirectGUI widgets).
And indeed, using “setColor” does result in an image applied via the “image” keyword-parameter being tinted!
(I would guess as a result of the internal structure of the DirectGUI widget and where, precisely, the colours set by “frameTexture” and “setColor” are respectively applied.)
So, the answer, I think, may be to simply switch to using the “frameColor” keyword-parameter rather than calling “setColor”!
To answer your question: in my menu, some buttons need to be clicked and others need to be mouse overed to be activated. So a simple Frame does the trick. Moreover, my buttons’ style is very simple: a square which changes color, so I didn’t wanted to deal with unnecessary buttons options like relief, animations, …