Re: findbar behaviour

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20121228204416.GC23272@local>
Jorge wrote:
> 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.

Let's see, I wanted to be able to focus the input, the next and previous
buttons, and the case-sensitive checkbox.
I wanted to be able to activate the buttons and toggle the checkbox with
either Space or Enter.
I wanted to be able to Tab to each of them, shift-Tab to go back, and to
have the tabbing wrap around.

I thought a little about bringing the close button into the loop, but
then I imagined it being easy to tab to by accident and inadvertently
close the bar, especially given that it already has a key combination.
I'm not quite sure, though.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.