> Jean-Pierre Lefebvre schrieb:
> > Hello,
> >
> > I am currently facing an issue with callback functions and Fl_Input.
> > I created a window, containing a Fl_Input object. I would like to run
> > the callback function when this input field is selected, even if
> > nothing changes in the field (simply to highlight some parts in my
> > interface).
>
> I think, you need to overwrite the handle():
>
> class Fl_Selected_Input: public Fl_Input
> {
> public:
> Fl_Selected_Input(int x, int y, int w, int h, const char* l= 0):
>       Fl_Input(x, y, w, h, l)
> {}
> virtual ~Fl_Selected_Input() {}
>
> protected:
> int handle(int event)
> {
>       if (event== FL_FOCUS)
>               do_callback(this, (void*) "Focus");
>       else if (event== FL_UNFOCUS)
>               do_callback(this, (void*) "Unfocus");
>
>       Fl_Input::handle(event);
> }
>
> };

OK, thanks a lot for your help.

Jean-Pierre.

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

Reply via email to