summaryrefslogtreecommitdiff
path: root/src/Fl_Scroll.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Scroll.cxx')
-rw-r--r--src/Fl_Scroll.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx
index 333c4892d..085d47bf0 100644
--- a/src/Fl_Scroll.cxx
+++ b/src/Fl_Scroll.cxx
@@ -32,16 +32,13 @@
/** Clear all but the scrollbars... */
void Fl_Scroll::clear() {
- // Note: the scrollbars are removed from the group before
- // calling Fl_Group::clear() to take advantage of the
- // optimized widget removal. Finally they are added
- // to the Fl_Scroll's group again.
- // This is MUCH faster than removing each widget.
- remove(scrollbar);
- remove(hscrollbar);
- Fl_Group::clear();
- add(hscrollbar);
- add(scrollbar);
+ for (int i=children() - 1; i >= 0; i --) {
+ Fl_Widget* o = child(i);
+ if (o != &hscrollbar && o != &scrollbar) {
+ remove(o);
+ delete o;
+ }
+ }
}
/** Insure the scrollbars are the last children */