DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2409
Version: 1.3-feature





Link: http://www.fltk.org/str.php?L2409
Version: 1.3-feature
Index: src/Fl_Group.cxx
===================================================================
--- src/Fl_Group.cxx    (Revision 7687)
+++ src/Fl_Group.cxx    (Arbeitskopie)
@@ -387,11 +387,28 @@
   savedfocus_ = 0;
   resizable_ = this;
   init_sizes();
+
+  // 
====================================================================================
+  // THIS SEEMS TO BE THE KEY 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  // 
====================================================================================
+  Fl_Widget *pushed = Fl::pushed();    // save pushed() widget --- see below 
to reset...
+  if (contains(pushed)) pushed = this; // set to this group, if it's a child
+  Fl::pushed(this);                    // set pushed() to the group for 
fix_focus etc.
+  // 
====================================================================================
+
   // okay, now it is safe to destroy the children:
   while (children_) {
-    Fl_Widget* o = child(0);   // *first* child widget
-    if (o->parent() == this) { // should always be true
-      remove(o);               // remove child widget first
+    //Fl_Widget* o = child(0); // *first* child widget
+    Fl_Widget* o = child(children_-1); // *last* child widget
+    if (o->parent() == this) {         // should always be true
+
+      if (children_>1) {               // optimized removal
+        o->parent_ = 0;                        // reset child's parent
+        children_--;                   // update counter
+      } else {                         // normal removal
+        remove(o);
+      }
+
       delete o;                        // then delete it
     } else {                   // this should never happen !
 #ifdef DEBUG_CLEAR
@@ -401,6 +418,11 @@
       remove(o);               // remove it
     }
   }
+
+  // ============================================================
+  Fl::pushed(pushed);          // reset Fl::pushed() widget
+  // ============================================================
+
 }
 
 /**
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to