From 5bbcebe9cd3f5f2676d210a77b9a67e213fa8f04 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sat, 19 Feb 2011 22:50:39 +0000 Subject: 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 --- src/Fl_Tree.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Fl_Tree.cxx') 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(); -- cgit v1.2.3