> > Albrecht wrote:
>
> Oh, yes, that's certainly true. If navigation happens to
> succeed in a subgroup, then this subgroup does it all. No
> parent group will notice. You could maybe derive an own
> Fl_Group class to do this in conjunction with its parent
> YourScroll class, but this could be a never ending story,
> unless you know exactly what groups and widgets you need
> in your special case.
>

Perhaps this is solve-able after all. New handle() below. I like this version a 
bit better, if only because it meets your original suggestion for a simple 
solution.

int handle(int event) {
  int ret = Fl_Scroll::handle(event);
  Fl_Widget* f_new = Fl::focus();
  if(f_new && (f_new != focus_tracker_) && contains(f_new))  {
    focus_tracker_ = f_new; // focus_tracker_ = NULL in ctor
    scroll_to(scroll_to_focus_x_(), scroll_to_focus_y_());
    redraw();
  }
  return ret;
}

I've deleted test_focus_() and scroll_to_focus_() functions as unused kruft. 
All the rest remains untouched.

New handle() just checks if focus (1) has moved and (2) is somewhere in the 
scroll group. I've done the membership test with contains(), which seems to 
return true even if the focus widget is nested. So far, at least.

I found the problem you mentioned re catching key combinations/order, 
especially w/ Shift+Tab, etc. If the above works, I can avoid the key problem 
altogether by ignoring the event code. Otherwise it may be a bottomless pit of 
testing the possible/accepted keycodes for changing focus. I -think- that the 
test above will catch any method of changing to the focus widget. I also 
-think- it's safe ... but I'll have to test some more.

The main oddity is that I've ditched testing whether the base handle() returned 
1. If I rely on that, I can't see nested widgets. Ignoring the value seems 
alright, but maybe this does something bad that I haven't caught yet.

Since the placement code seems to be working [knock on wood], I've cut the 
color changes / debug. Thanks for identifying how the color change happened to 
the input field - I hadn't figured that one out.

I'll post a new test unit when I've got it.

Denton
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to