Index: src/Fl_Tree.cxx
===================================================================
--- src/Fl_Tree.cxx	(revision 10696)
+++ src/Fl_Tree.cxx	(working copy)
@@ -1128,6 +1128,50 @@
   return(0);
 } 
 
+/// Clear the tree's child fltk widgets (does not affect items).
+/// Any fltk widgets parented to Fl_Tree will be removed and destroyed.
+///
+void Fl_Tree::clear_widgets() {
+#if FLTK_ABI_VERSION >= 10303		/* these methods need _tree (available only in ABI 10303) */
+  if ( _root ) {
+    _root->clear_children_widgets();	// let item handle clearing widgets
+    _root->clear_widget();
+  }
+#else
+  if ( _root ) {
+    for ( Fl_Tree_Item *i=first(); i; i=next_item(i,FL_Down) ) {
+      if ( i->widget() ) {		// item has widget assigned?
+        Fl_Widget *w = i->widget();
+        i->widget(0);			// remove from our item
+        Fl_Group::remove(*w);		// deparent from group
+        Fl::delete_widget(w);		// destroy the widget
+      }
+    }
+  }
+#endif
+  // Clear Fl_Group of children as well.
+  //    Any widgets not part of the tree belong to the app.
+  //    Do this in case app called Fl_Tree::clear() first.
+  //
+  for ( int t=0; t<Fl_Group::children(); t++ ) {
+    Fl_Widget *w = Fl_Group::child(t);
+#if FLTK_ABI_VERSION >= 10303
+    if ( w != _vscroll && w != _hscroll ) {
+      Fl_Group::remove(*w);
+      Fl::delete_widget(w);
+      --t;
+    }
+#else
+    if ( w != _vscroll ) {		// old ABI doesn't have _hscroll
+      Fl_Group::remove(*w);
+      Fl::delete_widget(w);
+      --t;
+    }
+#endif
+  }
+  recalc_tree();
+}
+
 /// Clear the entire tree's children, including the root.
 /// The tree will be left completely empty.
 ///
Index: src/Fl_Tree_Item.cxx
===================================================================
--- src/Fl_Tree_Item.cxx	(revision 10696)
+++ src/Fl_Tree_Item.cxx	(working copy)
@@ -198,7 +198,45 @@
   return(_children[index]);
 }
 
-/// Clear all the children for this item.
+#if FLTK_ABI_VERSION >= 10303	/* these methods need _tree (available only in ABI 10303) */
+
+/// Clear the widget assigned to this item (if any).
+/// The widget is destroyed and widget() set to 0.
+/// The tree's geometry is recalculated unless recalc==0.
+///
+/// param[in] recalc Set to 0 to avoid costly recalculation of tree
+///                  geometry, useful if clearing many widgets before
+///                  a redraw. Default is 1.
+///
+void Fl_Tree_Item::clear_widget(int recalc) {
+  if (widget()) {
+    Fl_Widget *w = widget();
+    widget(0);				// remove from our item
+    _tree->Fl_Group::remove(*w);	// deparent from group
+    Fl::delete_widget(w);		// destroy the widget
+    if (recalc) recalc_tree();		// removing widget can change tree geom
+  }
+}
+
+/// Clear all the fltk widgets assigned to this item's child items.
+/// The tree's geometry is recalculated unless recalc==0.
+///
+/// param[in] recalc Set to 0 to avoid costly recalculation of tree
+///                  geometry, useful if clearing many widgets before
+///                  a redraw. Default is 1.
+///
+void Fl_Tree_Item::clear_children_widgets(int recalc) {
+  for ( int t=0; t<children(); t++ ) {
+    if ( child(t)->has_children() ) {
+      child(t)->clear_children_widgets();
+    }
+    child(t)->clear_widget();
+  }
+  if (recalc) recalc_tree();	// removing widgets can change tree geom
+}
+#endif
+
+/// Clear all the child items of this item.
 void Fl_Tree_Item::clear_children() {
   _children.clear();
   recalc_tree();		// may change tree geometry
Index: FL/Fl_Tree.H
===================================================================
--- FL/Fl_Tree.H	(revision 10696)
+++ FL/Fl_Tree.H	(working copy)
@@ -389,6 +389,7 @@
   Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
   Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
   int remove(Fl_Tree_Item *item);
+  void clear_widgets();
   void clear();
   void clear_children(Fl_Tree_Item *item);
Index: FL/Fl_Tree_Item.H
===================================================================
--- FL/Fl_Tree_Item.H	(revision 10696)
+++ FL/Fl_Tree_Item.H	(working copy)
@@ -243,6 +243,10 @@
   int find_child(Fl_Tree_Item *item);
   int remove_child(Fl_Tree_Item *item);
   int remove_child(const char *new_label);
+#if FLTK_ABI_VERSION >= 10303	/* these methods need _tree (available only in ABI 10303) */
+  void clear_widget(int recalc=1);
+  void clear_children_widgets(int recalc=1);
+#endif
   void clear_children();
   void swap_children(int ax, int bx);
   int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
Index: test/tree.fl
===================================================================
--- test/tree.fl	(revision 10696)
+++ test/tree.fl	(working copy)
@@ -42,6 +42,18 @@
   comment {// Global callback event counter} private local
 } 
 
+decl {Fl_Input *G_in = 0;} {
+  comment {// Global Fl_Input we add to item} private local
+} 
+
+decl {Fl_Button *G_but = 0;} {
+  comment {// Global Fl_Button we add to item} private local
+} 
+
+decl {Fl_Group *G_grp = 0;} {
+  comment {// Global Fl_Group we add to item} private local
+} 
+
 Function {reason_as_name(Fl_Tree_Reason reason)} {
   comment {Return an Fl_Tree_Reason as a text string name} return_type {const char*}
 } {
@@ -148,40 +160,39 @@
 tree->add("Bbb/child-04");
 
 {
-    static Fl_Input *in = 0;
     // Assign an FLTK input widget to one of the items with a label() of its own (STR\#2832)
     Fl_Tree_Item *i;
     if ( ( i = tree->find_item("Bbb/child-02") ) != NULL ) {
-        if ( !in ) {		// only do this once at program startup
+        if ( !G_in ) {
             tree->begin();
-            in = new Fl_Input(1,1,100,1,"Fl_Input test");	// we control w() only
-            in->labelsize(10);
-            in->textsize(10);
-            in->align(FL_ALIGN_RIGHT);				// show label to the right of the widget
-	    in->tooltip("Fl_Input inside tree.\\n"
-	                "The widget's label 'Fl_Input test' should appear to the widget's right.");
+              G_in = new Fl_Input(1,1,100,1,"Fl_Input test");	// we control w() only
+              G_in->labelsize(10);
+              G_in->textsize(10);
+              G_in->align(FL_ALIGN_RIGHT);			// show label to the right of the widget
+	      G_in->tooltip("Fl_Input inside tree.\\n"
+	                    "The widget's label 'Fl_Input test' "
+	                    "should appear to the widget's right.");
+            tree->end();
         }
-        i->widget(in);
-        tree->end();
+        i->widget(G_in);
     }
 }
 
 {
-    static Fl_Button *but = 0;
     // Assign an FLTK widget to one of the items
     Fl_Tree_Item *i;
     if ( ( i = tree->find_item("Bbb/child-03") ) != NULL ) {
-        if ( !but ) {		// only do this once at program startup
+        if ( !G_but ) {
             tree->begin();
-            but = new Fl_Button(1,1,140,1,"ccc button");     // we control w() only
-            but->labelsize(10);
-	    but->callback(Button_CB);
-	    but->tooltip("Button inside tree.\\n"
-	                 "If 'Item h() from widget' enabled, "
-	                 "pressing button enlarges it.");
+              G_but = new Fl_Button(1,1,140,1,"ccc button");    // we control w() only
+              G_but->labelsize(10);
+	      G_but->callback(Button_CB);
+	      G_but->tooltip("Button inside tree.\\n"
+	                     "If 'Item h() from widget' enabled, "
+	                     "pressing button enlarges it.");
+            tree->end();
         }
-        i->widget(but);
-        tree->end();
+        i->widget(G_but);
     }
 }
 {
@@ -192,26 +203,24 @@
 	                 "pressing either button enlarges the group "
 	                 "and both buttons together.";
     if ( ( i = tree->find_item("Bbb/child-04") ) != NULL ) {
-        static Fl_Group *grp = 0;
-        if ( !grp ) {		// only do this once at program startup
+        if ( !G_grp ) {
             tree->begin();
-              grp = new Fl_Group(100,100,140,18); // build group.. tree handles position
-              grp->color(FL_WHITE);
-              grp->begin();
-                Fl_Button *abut = new Fl_Button(grp->x()+0 ,grp->y()+2,65,15,"D1");
+              G_grp = new Fl_Group(100,100,140,18); // build group.. tree handles position
+              G_grp->color(FL_WHITE);
+              G_grp->begin();
+                Fl_Button *abut = new Fl_Button(G_grp->x()+0 ,G_grp->y()+2,65,15,"D1");
                 abut->labelsize(10);
 		abut->callback(Button_CB);
 		abut->tooltip(tipmsg);
-                Fl_Button *bbut = new Fl_Button(grp->x()+75,grp->y()+2,65,15,"D2");
+                Fl_Button *bbut = new Fl_Button(G_grp->x()+75,G_grp->y()+2,65,15,"D2");
                 bbut->labelsize(10);
 		bbut->callback(Button_CB);
 	        bbut->tooltip(tipmsg);
-
-              grp->end();
-              grp->resizable(grp);
+              G_grp->end();
+              G_grp->resizable(G_grp);
             tree->end();
         }
-        i->widget(grp);
+        i->widget(G_grp);
     }
 }
 
@@ -254,7 +263,8 @@
 
 AssignUserIcons();
 
-tree->redraw();} {}
+tree->redraw();} {selected
+  }
 } 
 
 Function {EditColor(Fl_Color &val)} {
@@ -346,7 +356,7 @@
 } {
   Fl_Window window {
     label tree open
-    xywh {115 293 1045 580} type Double hide
+    xywh {115 293 1045 600} type Double visible
   } {
     Fl_Group tree {
       label Tree
@@ -640,7 +650,7 @@
     case 2:  tree->selectmode(FL_TREE_SELECT_MULTI);  break; 	// Multi
     case 3:  tree->selectmode(FL_TREE_SELECT_SINGLE_DRAGGABLE);  break; // Single draggable
     default: tree->selectmode(FL_TREE_SELECT_SINGLE); break;	// Single
-}} open selected
+}} open
         tooltip {Tests Fl_Tree::selectmode()
 Sets how Fl_Tree handles mouse selection of tree items.
     NONE	-- Not selectable by keyboard/mouse
@@ -801,7 +811,7 @@
       }
       Fl_Box {} {
         label {Test Operations}
-        tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {350 435 330 125} box GTK_DOWN_BOX color 47 labelsize 12 align 1
+        tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {350 435 330 140} box GTK_DOWN_BOX color 47 labelsize 12 align 1
       }
       Fl_Box showitem_box {
         label {show_item()
@@ -918,12 +928,22 @@
         tooltip {Closes all nodes that have children
 (doesn't affect 'root')} xywh {570 451 95 16} labelsize 9
       }
+      Fl_Button clearwidgets_button {
+        label {Clear Widgets}
+        callback {tree->clear_widgets();
+tree->redraw();
+G_in  = 0;  // destroyed by clear_widgets()
+G_but = 0;  // destroyed by clear_widgets()
+G_grp = 0;  // destroyed by clear_widgets()}
+        tooltip {Tests Fl_Tree::clear_widgets().
+Clears child FLTK widgets only (not items)} xywh {570 471 95 16} labelsize 9
+      }
       Fl_Button clearall_button {
         label {Clear All}
         callback {tree->clear();
 tree->redraw();}
         tooltip {Tests Fl_Tree::clear().
-Clears all items} xywh {570 471 95 16} labelsize 9
+Clears all items} xywh {570 489 95 16} labelsize 9
       }
       Fl_Button testcallbackflag_button {
         label {Test Callback Flag}
@@ -988,14 +1008,14 @@
 tree->deselect("ROOT"); // leave deselected
 
 fl_alert("TEST COMPLETED\\n If you didn't see any error dialogs, test PASSED.");}
-        tooltip {Test the 'docallback' argument can disable callbacks.} xywh {570 491 95 16} labelsize 9
+        tooltip {Test the 'docallback' argument can disable callbacks.} xywh {570 509 95 16} labelsize 9
       }
       Fl_Button testrootshowself_button {
         label {Root Show Self}
         callback {Fl_Tree_Item *root = tree->root();
 fprintf(stderr, "--- Show Tree\\n");
 if (root) root->show_self();}
-        tooltip {Test the root->'show_self() method to show the entire tree on stdout} xywh {570 511 95 16} labelsize 9
+        tooltip {Test the root->'show_self() method to show the entire tree on stdout} xywh {570 529 95 16} labelsize 9
       }
       Fl_Button add20k_button {
         label {Add 20,000}
@@ -1016,7 +1036,7 @@
     item = item->next();
 }
 tree->redraw();}
-        tooltip {Adds 20,000 items to the selected item's parent} xywh {570 531 95 16} labelsize 9
+        tooltip {Adds 20,000 items to the selected item's parent} xywh {570 549 95 16} labelsize 9
       }
       Fl_Box {} {
         label {Selected Items}
