On Thu, Dec 27, 2012 at 08:38:24PM +0000, corvid wrote:
Jorge wrote:
On Wed, Dec 26, 2012 at 11:29:50PM +0000, corvid wrote:
Here's what resulted, but it seems relatively inelegant: [snipped long patch]
It's much simpler. In this case you can let FLTK do the focus change among widgets:
diff -r 20a26b8bb366 src/findbar.cc --- a/src/findbar.cc Wed Dec 26 23:31:48 2012 +0100 +++ b/src/findbar.cc Thu Dec 27 15:32:02 2012 -0300 @@ -158,7 +158,6 @@ Findbar::Findbar(int width, int height) check_btn = new Fl_Check_Button(x, border, 2*button_width, height, "Case-sensitive"); x += 2 * button_width + gap; - check_btn->clear_visible_focus(); add(check_btn);
}
and that's it, forward with Tab, back with Shift+Tab.
Now, if there's a need for something more special, like letting Tab alone cycle around, adding this will do:
@@ -179,6 +178,10 @@ int Findbar::handle(int event) if (event == FL_KEYBOARD && modifier == 0 && k == FL_Escape) { /* let the UI handle it */ return 0; + } else if (event == FL_KEYBOARD && modifier == 0 && k == FL_Tab) { + MSG("Findbar::handle FL_KEYBOARD Tab\n"); + (Fl::focus() == i) ? check_btn->take_focus() : i->take_focus(); + return 1; }
return Fl_Group::handle(event);
I wanted to make the findbar as functional as one would customarily expect, though.
Please elaborate. -- Cheers Jorge.-