simon wrote:
> I need to make it so that if is presed it changes color,
> and if it is pressed again it goes back to the initial coor.
I'd do it this way:
#include <FL/Fl.H>
#include "FL/Fl_Window.H"
#include "FL/Fl_Light_Button.H"
void Button_CB(Fl_Widget *w, void*)
{
Fl_Light_Button *b = (Fl_Light_Button*)w;
b->color( b->value() ? FL_RED : FL_GRAY);
b->redraw();
}
int main()
{
Fl_Window *win = new Fl_Window(350, 300);
Fl_Light_Button *but = new Fl_Light_Button(10,10,140,25, "Toggle");
but->callback(Button_CB);
win->resizable(win);
win->show();
return(Fl::run());
}
You could use a regular Fl_Button too, you'd just have to keep
track of the toggle state yourself in your callback, and change
the color accordingly.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk