When we add an ofColor parameter to an ofxGui panel, the widget color is not updated on every frame (besides it happens for any other parameters like sliders, label strings etc)
The widget color is updated only when we click on the color widget.
I would like to see the panel color changing when the ofColor is being changed by code, (i.e. tweening or changing)
@arturoc says:
'this sounds like a bug, can you open an issue on gihub?'
pictures here:
https://forum.openframeworks.cc/t/how-to-update-the-color-for-ofcolor-widget-in-ofxgui/33531
Hi, the widgets do not get updated on each frame, only when needed. I've noticed this problem too, and it has to do with how the event notifications are handled. I will take a look at it.
ok, thanks.
btw, do you know if I can update the color widget color manually?
@moebiussurfing
May not be very correct, but it seems to be useful.
ofxSliderGroup.cpp line:209 Header color update when value changed.
if (isMinimized())
{
setHeaderBackgroundColor(value);
}
`template
void ofxColorSlider_
if (sliderChanging){
return;
}
for (int i=0; i<4; i++){
parameters[i].template cast
collection[i]->setFillColor(value);
auto p = parameters[i].template cast
float range = p.getMax()-p.getMin();
if(range == 0){
collection[i]->setTextColor( ofFloatColor(0.));
}else{
collection[i]->setTextColor( p/range > 0.75 ? ofFloatColor(0.) : ofFloatColor(1.));
}
}
if (isMinimized())
{
setHeaderBackgroundColor(value);
}
}`
thanks @LYHSH ,
but I don't know how to use this snippet...
I have the color parameter added to an ofParameterGroup, and then this one added to an ofxPanel.
So maybe I need to iterate all the params inside the panel by name & ofxColorSlider type, and then to apply this setHeaderBackgroundColor(value)...
If you think it's easy to explain to me I'll be happy, but nevermind if it's out of my skills..
Can verify @LYHSH snippet works, sending a PR in a bit, already working in my built oF, need to make the change to the Github copy now to send it.
thanks, now it's working.
but i have noticed that when the color is black, text color is showed black too, so text is missing.
then goes showing back after clicking on it...
Fixed with #6440
hey @sourya-sen ,
did you make this fix under Windows/Linux? I think it's working in Windows but not in macOS...
@moebiussurfing did it in macOS, it was working fine. I'll take another look at it later today.