On 03.11.2010, at 13:03, Albrecht Schlosser wrote: > On 02.11.2010, at 13:19, Matthias Melcher wrote: >> >> On 01.11.2010, at 20:27, Greg Ercolano wrote: >> >>> Boris Mayer-St-Onge wrote: >>>> With FLTK 1.1.10 or one of 1.3.x snapshot (7677), I can't change the >>>> position of widgets Fl_Input and Fl_Output. >>> >>> You can, you just have to beware of the name collision, >>> and code accordingly. >>> >>> We should have some clear docs that describe the collision, >>> and how to work around it, at very least. >>> >>>> If we look into Fl_Widget and Fl_Input_, we can see that >>>> Fl_Widget::position(X,Y) is a shortcut to resize(X,Y,w(),h()) but in >>>> Fl_Input_, the function position(X,Y) is redefined and is more complicated. >>> >>> Yes, there's a name collision for position(); >>> Fl_Input_::position() sets cursor position/text selection, >>> Fl_Widget::position() sets the widget's X/Y position. >>> >>> Definitely unfortunate API planning ;) >> >> I would like to change the API for Fl_Input. I have not found a good name >> yet. Any suggestions welcome. We did the exact same thing for Fl_Scroll >> which also overrode position(int, int) > > Yes, we did change the API for Fl_Scroll, but IMHO this was a less > invasive change, because Fl_Scroll::position(int,int) to change the > scrollbar position was supposedly used much less. However, here we > would probably break more existing code than with the Fl_Scroll > change (also taking into account that we did the Fl_Scroll change > early in fltk 1.3 development), but now I guess that we have fltk 1.3 > code in use, maybe even in production environments. > > That said, I agree that we should change the API, but I would like > to keep the old function as a compatibility wrapper for a while, > as Greg also suggested. > > IMHO we should add a new method, document that the old method > is deprecated, and remove it in the following release after 1.3.x, > i.e. 1.4 or 3.0. > > We have (with comments from the doxygen docs): > > position() - Gets the position of the text cursor. > > position(int) - Set the cursor position and mark. > position(n) is the same as position(n, n). > > position(int,int) - Sets the index for the cursor and mark. > > and: > > mark() - Gets the current selection mark. > mark(int) - Sets the current selection mark. > > Method name proposals to replace position(...): > > - cursor_position(...) or > - text_position(...) or > - insert_position(...)
So position() with two arguments (assuming they are not equal) actually sets the primary selection. So maybe select(from, to) would be the right name. In gcc, we can mark the Fl_Input_ funciton as deprecated. But then we would also get the warning for correct usage. Hmmmm. Matthis _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
