Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-06 Thread Denton Thomas
> No, sorry for being unclear. It's solely to detect that the current > focus_tracker_ variable value is invalid. This would enable you to > see when the current focus widget (inside your group) loses focus > and gets it again. Otherwise you wouldn't scroll the widget back > into the visible area i

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-06 Thread Albrecht Schlosser
On 05.01.2013 23:01, Denton Thomas wrote: > Albrecht wrote: > >> What about adding here: >> >>if (!contains(f_new)) focus_tracker_ = 0; // focus in another group >> >>> if(f_new && (f_new != focus_tracker_) && contains(f_new)) { >>> focus_tracker_ = f_new; // focus_t

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-05 Thread Denton Thomas
> >>> Albrecht wrote: > What about adding here: > > if (!contains(f_new)) focus_tracker_ = 0; // focus in another group > > >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

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-04 Thread Albrecht Schlosser
On 04.01.2013 12:36, Denton Thomas wrote: > New handle() below. I like this version a bit better, if only because it > meets your original suggestion for a simple solution. Please see also my RFC in fltk.general: Albrecht

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-04 Thread Albrecht Schlosser
On 04.01.2013 12:36, Denton Thomas wrote: >>> 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 p

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-04 Thread Denton Thomas
> > 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 n

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-04 Thread Albrecht Schlosser
On 04.01.2013 10:05, Albrecht Schlosser wrote: > the scroll widget (see the notes and the callback). You may > need to call the parent's redraw method as well, if you have > a frame box time somewhere, so that the redraw doesn't draw ... frame box TYPE ... (fingers faster than mind ;-) ) Albrec

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-04 Thread Albrecht Schlosser
On 04.01.2013 03:12, Denton Thomas wrote: > Albrecht wrote: >> It's not perfect, and maybe some of the changes would turn out >> to be useless... just take it as a base for more own experiments. >> > > Thanks for all this, Albrecht. I'll certainly use those immediately. I > appreciate it, as this

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-03 Thread Denton Thomas
Albrecht wrote: > It's not perfect, and maybe some of the changes would turn out > to be useless... just take it as a base for more own experiments. > Thanks for all this, Albrecht. I'll certainly use those immediately. I appreciate it, as this is part of a current project. I'll keep testing re

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-03 Thread Albrecht Schlosser
On 03.01.2013 05:47, Denton Thomas wrote: > For both of you (Ian, Albrecht), here is my solution. It includes a test > sequence that produces some random buttons, and lets the client dynamically > change the size of the scrollbar. I wanted to allow a dynamic box style > change for the scroll gr

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Denton Thomas
Ian wrote: > Ah, but there's a thought... If Denton has already modified his widgets = > to handle the focus differently, then they may perhaps be "eating" the = > nav events, thus preventing them from propagating to the container = > scroll widget at all? > I may have done that, yes. Have to go b

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Ian MacArthur
On 2 Jan 2013, at 12:14, Albrecht Schlosser wrote: > Yep, that's also correct, but fortunately normal FLTK widgets don't > *use* the navigation keys. Hence, navigation key events usually return > zero from the widget's handle() method, and the group gets it. Ah, but there's a thought... If Den

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Albrecht Schlosser
On 02.01.2013 14:12, Denton Thomas wrote: >> On 02.01.2013 13:14, Albrecht Schlosser wrote: > .. >>> > >>> Fl_Widget *fw = Fl::focus(); // save focus widget >>> int ret = Fl_Scroll::handle(event); >>> if (ret && fw != Fl::focus) { // event used and focus changed > .. >> Albrecht >> > >

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Denton Thomas
> On 02.01.2013 13:14, Albrecht Schlosser wrote: .. > > > >Fl_Widget *fw = Fl::focus(); // save focus widget > >int ret = Fl_Scroll::handle(event); > >if (ret && fw != Fl::focus) { // event used and focus changed .. > Albrecht > Thanks for all this, Albrecht. I started mucking with an

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Albrecht Schlosser
On 02.01.2013 13:14, Albrecht Schlosser wrote: > So the approach to subclass Fl_Scroll should work as suggested. > It could maybe need just a little code in handle(), something > like this might suffice: > > MyScroll::handle(int event) { > >Fl_Widget *fw = Fl::focus(); // save focus widget >

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-02 Thread Albrecht Schlosser
On 01.01.2013 23:39, Ian MacArthur wrote: > > On 1 Jan 2013, at 21:44, Denton Thomas wrote: > > >>> 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. >>> >> >> Ye

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-01 Thread Ian MacArthur
On 1 Jan 2013, at 21:44, Denton Thomas wrote: >> 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. >> > > Yep, I agree. I've just made a template to add the ha

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-01 Thread Denton Thomas
Thanks for that, Ian. > > 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. > Yep, I agree. I've just made a template to add the handlers to any old widget, but it

Re: [fltk.general] scroll to focus in Fl_Scroll

2013-01-01 Thread Ian MacArthur
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 metho

[fltk.general] scroll to focus in Fl_Scroll

2012-12-31 Thread Denton Thomas
Hi, All - Perhaps this has been asked before, but I couldn't find it in the forums. A RTM link would be great ... ! 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 ou