On 5 Nov 2012, at 20:33, Greg Ercolano wrote:

> On 11/05/12 11:58, Laszlo Antal wrote:
>> On Nov 5, 2012, at 9:06, Doug Parks <[email protected]> wrote:
>>>> Is it possible to compare the color of a widget in an "if" statement?  If 
>>>> so how would I go about doing it.  I have tried using a standard 
>>>> comparison but it says it is unable to do it.
>>> 
>>> I figured it out.  Sorry for the inconvenience.
>> 
>> And your solution is?
> 
>       You can get the color of a widget with Fl_Widget::color()
>       and compare it like an integer.
> 
>       If it's a color-map color, you could use:
> 
>       if ( w->color() == FL_RED )
> 
>       ..or if it's an RGB value, you could use:
> 
>       if ( w->color() == 0xffaa8800 )


As a "sub-note" to Greg's example, I think there's an implicit point there that 
maybe can be made explicit, which is that comparing colours for 
equality/inequality makes sense, but testing for greater/lesser maybe does not; 
is red > blue? Or...?





_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to