SimpleView.st
changeset 1296 dc646cdf78f0
parent 1293 530a47b8dc4c
child 1297 6fe5dfeba2c8
--- a/SimpleView.st	Wed Jan 29 14:17:45 1997 +0100
+++ b/SimpleView.st	Wed Jan 29 17:36:03 1997 +0100
@@ -2420,10 +2420,15 @@
 container:aContainer
     "set my container (i.e. superView) to be aContainer"
 
+    (superView notNil and:[superView ~~ aContainer]) ifTrue:[
+        "/ actually, this is worth an exception
+        ('View: ' , self printString , ' already has a container') errorPrintCR.
+        superView removeComponent:self.
+    ].
     superView := aContainer
 
     "Created: 9.5.1996 / 00:40:56 / cg"
-    "Modified: 9.5.1996 / 00:45:40 / cg"
+    "Modified: 29.1.1997 / 17:35:06 / cg"
 !
 
 lower
@@ -3132,16 +3137,19 @@
     "remove all subviews"
 
     subViews notNil ifTrue:[
-"/        subViews copy do:[:aSubView |
-"/            aSubView destroy.
-"/        ]
-        [subViews size > 0] whileTrue:[
-            subViews first destroy
-        ]
+        subViews copy do:[:aSubView |
+            aSubView destroy.
+        ].
+
+        "/ paranoia ;-)
+        subViews size ~~ 0 ifTrue:[
+            ('View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR.
+            subViews := nil
+        ].
     ]
 
     "Modified: 5.9.1995 / 22:35:36 / claus"
-    "Modified: 28.1.1997 / 18:02:07 / cg"
+    "Modified: 29.1.1997 / 17:07:45 / cg"
 !
 
 removeComponent:aComponent
@@ -6573,6 +6581,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.160 1997-01-29 12:20:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.161 1997-01-29 16:36:03 cg Exp $'
 ! !
 SimpleView initialize!