0

is there a way to write an if statement in an fltk project such that it looks at the colour of an Fl_Box, and then returns a value? Something like this:
if(color(Fl_Box)==FL_Blue)
{int i=0}
Thanks in advance.

Aegir
  • 117
  • 11

1 Answers1

1

Sure, all widgets have the color() function (see http://www.fltk.org/doc-1.3/classFl__Widget.html#a03c07e0725994cddf9070f9f1cd215c4 ).

If you look in Enumerations.H in the FLTK includes folder is has const Fl_Color FL_BLUE = 216; so you would want to use FL_BLUE and naturally you would need to actually have a pointer to the widget in question so you would have

  if (some_box->color()==FL_BLUE)

where somewhere else in your code you have

  Fl_Box* some_box;
  some_box = new Fl_Box(x,y,w,h,"Name");
user3353819
  • 911
  • 2
  • 8
  • 21