Albrecht Schlosser wrote: > > DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. > > [STR New] > > Link: http://www.fltk.org/str.php?L2338 > Version: 1.3-feature > > > We could call it top_widget() or top_group(), but please not top_window(). > Although not very usual, a widget can be removed from its parent = group > (maybe window) and doesn't have a window then. > > Since it returns an Fl_Group(), we can't easily return "this" if the > widget itself is the top-level _widget_, but is not an Fl_Group. Thus, > returning NULL if the widget is top-level itself would be more consistent, > unless we return this->as_group() instead (which can also be NULL). > > OTOH, if the question was to find the top-level window, then the method > should not use parent() but window() internally, with the same restriction > that a widget doesn't necessarily have a window. I know that there are some > loops that look for the top-level window in the FLTK core, so this would be > usable internally as well. > > So, maybe we should extend this to add both: > Fl_Widget::top_window() and Fl_Widget::top_group(). > > > Link: http://www.fltk.org/str.php?L2338 > Version: 1.3-feature >
Good point, I didn't know the existence of Fl_Widget::window() it does what I was looking for, and is implemented in a similar way. So my original propose becomes unnecessary ! I remove it. _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
