I'm looking for a way to programmatically manipulate which line in Fl_Browser 
has keyboard focus (fltk-1.1.8). That is, not the line which is selected but 
the line which has keyboard focus e.g. by using cursor up/down keys.

So far the best way I've found is (in my Fl_Browser subclass):

int focus=lineno(selection()); // get focus
Fl_Browser_::select(find_line(focus),0); // set focus

This was very difficult to discover because:
- Fl_Browser::lineno() and Fl_Browser::find_line() methods are undocumented
- selection() and select() belong to Fl_Browser_, and documentation (and method 
names) imply they manipulate selection while actually they manipulate focus
- Even weirder, Fl_Browser::select() really does manipulate selection

I'd suggest to implement new methods set_focus() and get_focus() like in fltk2 
and efltk. Are there such methods already? if not, I'll open a RFE.

Also it is very bad practice to have overloaded method do something completely 
different (in case of select()). That is another RFE if I'm correct.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to