diff options
| author | Greg Ercolano <erco@seriss.com> | 2011-02-19 22:50:39 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2011-02-19 22:50:39 +0000 |
| commit | 5bbcebe9cd3f5f2676d210a77b9a67e213fa8f04 (patch) | |
| tree | b614dbf20f8d01134c237f59630b154d06dbcab6 | |
| parent | 723fe666cfc32043b73ffe7f625cde343a59c378 (diff) | |
Small mod for NULL behavior of show_item(item,yoff). (STR#2517)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8450 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_Tree.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx index a96ed2d6f..c2b29d159 100644 --- a/src/Fl_Tree.cxx +++ b/src/Fl_Tree.cxx @@ -782,13 +782,14 @@ int Fl_Tree::select_only(Fl_Tree_Item *selitem, int docallback) { /// the value will be clipped. So if yoff=100, but scrollbar's max /// is 50, then 50 will be used. /// -/// \param[in] item The item to be shown. Should not be NULL. +/// \param[in] item The item to be shown. If NULL, first() is used. /// \param[in] yoff The pixel offset from the top for the displayed position. /// /// \see show_item_top(), show_item_middle(), show_item_bottom() /// void Fl_Tree::show_item(Fl_Tree_Item *item, int yoff) { - if ( ! item ) return; + item = item ? item : first(); + if (!item) return; int newval = item->y() - y() - yoff + (int)_vscroll->value(); if ( newval < _vscroll->minimum() ) newval = (int)_vscroll->minimum(); if ( newval > _vscroll->maximum() ) newval = (int)_vscroll->maximum(); |
