On 01/04/13 05:22, Albrecht Schlosser wrote:
> I'd like to know if there are more FLTK users who have the need
> to track the widget that currently has the focus.

        I wouldn't be against it.. sounds reasonable.

> I could imagine something like a callback that could be called
> whenever the current focus widget (Fl::focus()) changes. This
> could be something like:
> 
>    Fl::register_focus[_tracking] (my_widget,callback,arg)

        Seems like:

                Fl::add_focus_callback(cb, data);
                Fl::remove_focus_callback(cb,data);

        ..would make sense.

>    void callback (Fl_Widget *w, long or void * arg, Fl_Widget *focus)
> The last argument is just to avoid calling Fl::focus() each time
> the callback is called, but could also be removed. 

        I'd prefer the user's callback code do the Fl::focus() call
        (if it needs it) rather than a third arg so as to be consistent
        with Fl_Callback and it's always easier to remember shorter arg lists.

        Plus whatever few cycles are saved by preventing the user from calling
        Fl::focus() are probably undone by the stack manipulations of handling
        a third arg in the callback..
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to