On 30.03.2011 17:42, J P wrote: > I have a window with a bunch of Fl_Input fields, and am trying to determine > how I can bind a callback to a Fl_Input that will be called when a shortcut > takes place and that particular Fl_input has keyboard focus. > > So.. > 1) User puts keyboard cursor in input field > 2) User hits ctrl+v > 3) Callback takes place, passing widget with keyboard focus.
So this is the part that works, right? > My other option is to have a Fl_menu keyboard shortcut that will perform a > callback passing the whole window and all its members, and then I will > determine which Fl_input has keyboard focus from 'this' and perform the > appropriate function. But I can't see a Fl_Input public function that > returns whether not the widget has keyboard focus. > > Hope this makes sense. Thanks for the help/advice! You can get the current focus widget with Fl_Widget fw = Fl::focus(); and compare it with your list of Fl_Input fields, if you have such a list, but from your question above, I assume yes. Take care that it is not another widget type that has the focus (a button can also have the focus). <http://www.fltk.org/doc-1.3/group__fl__events.html#ga7f0e9836db43268979e0b3a999583b7f> Another way would be to subclass Fl_Input and add a method that does what you need, but that's probably not easier. Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

