Andreas Ekstrand wrote:
> That would be great, I hope someone (Albrecht?) knows the answer to this. I 
> also hope there won't be other problems instead...

Andreas, would you please test the attached version?

This is not the final version yet, but if it works in your
context and is fast enough, this would be fine.  It's a first
proof of concept, but it shouldn't have the fix_focus problem,
and it is very fast.

As before, please replace Fl_Group::clear() with the attached
full code.

Albrecht

----- attached code -----

void Fl_Group::clear() {
   int i,j;
   savedfocus_ = 0;
   resizable_ = this;
   init_sizes();
   // okay, now it is safe to destroy the children:
   // revert them first
   if (children_ > 1) {
     Fl_Widget *temp;
     Fl_Widget **a = (Fl_Widget**)array();
     for (i=0,j=children_-1; i<children_/2; i++,j--) {
       temp = a[i];
       a[i] = a[j];
       a[j] = temp;
     }
   }
   while (children_) {                  // delete all children
     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 {                         // slow removal
         remove(o);
       }
       delete o;                                // delete the child
     } else {                           // should never happen
       remove(o);                       // remove it anyway
     }
   }
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to