On 1 Jan 2013, at 00:07, Denton Thomas wrote: > I have an Fl_Scroll with many widgets (buttons, text displays, etc). If I tab > through those widgets, I will eventually change focus to a widget that is in > the scroll group but outside the visible scroll position. > > Is there a existing method the Fl_Scroll to notice when the focus widget is > not visible, and then to scroll itself to put that widget in view?
Hmm, I don't think we have any specific mechanism for handling keyboard navigation within a scroll widget. I don't think I've ever seen this asked before either, which seems odd, since it does seem like a reasonable behaviour (to have the scroll move to expose the focussed widget following keyboard navigation...) Or I may be missing something really obvious and this is actually trivial! > From what I can tell, this is not a trivial task. > > I previously used a custom handle() in each child to tell Fl_Scroll when > FL_FOCUS changes, then Fl_Scroll::scroll_to(x,y) to put the widget in view > ... but perhaps this is not the best method? I think I'd have gone at this the other way round; that is, derive a custom widget from Fl_Scroll and fill it with "standard" widgets. The handle method of the derived scroll would of course call the base handle method, then check to see if the focus had moved to a non-visible widget and try to do the scroll_to() as required. Well, something like that - though I have not tried it... My thinking is that this *should* work and would mean that only one "special" derived widget is needed, rather than having to make every contained widget be a "special" widget. If you try this; I'd be interested to hear how it works out! Cheers, bliadhna mhath ùr... -- Ian _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk