#BUGFIX by ca
authorca
Thu, 12 Dec 2019 10:00:28 +0100
changeset 6749 1ba3302417a6
parent 6748 9669c3f0bc4b
child 6750 23bf1e00dc95
#BUGFIX by ca class: VerticalPanelView class definition changed: #beVisiblePostUpdate #storePreferredHeight:for:
VerticalPanelView.st
--- a/VerticalPanelView.st	Wed Dec 11 13:16:08 2019 +0100
+++ b/VerticalPanelView.st	Thu Dec 12 10:00:28 2019 +0100
@@ -16,7 +16,7 @@
 "{ NameSpace: Smalltalk }"
 
 PanelView subclass:#VerticalPanelView
-	instanceVariableNames:'rowHeight storedPreferredHeight'
+	instanceVariableNames:'rowHeight'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Layout'
@@ -777,48 +777,32 @@
 !
 
 beVisiblePostUpdate
-    "after making the views visible check the vertical layout"
+    "after making the views visible check the vertical layout; called by #beVisible"
 
    | sviews |
 
-    storedPreferredHeight isNil ifTrue:[ storedPreferredHeight := IdentityDictionary new ].
-    
-    storedPreferredHeight keysDo:[: eachView |
-        (subViews includes: eachView) ifFalse:[
-            sviews isNil ifTrue:[ sviews := OrderedCollection new ].
-            sviews add: eachView
-        ]
-    ].
-    sviews size > 0 ifTrue:[
-        sviews do:[: eachView | storedPreferredHeight removeKey: eachView ifAbsent:nil ].
-    ].
-    
     self isVisible ifFalse:[ ^ self ].
     sviews := self subViewsToConsider.
     sviews size > 1 ifFalse:[ ^ self].
 
-    mustRearrange := true.
     sviews do:[: eachChild |
-        eachChild height: 0.
-        eachChild height: (storedPreferredHeight at: eachChild ifAbsent:[ eachChild computePreferredExtent y ]).
+        eachChild isView ifTrue:[ | h |
+            h := eachChild getAttribute:#VerticalPanelPreferredHeight.  "/ see: #storePreferredHeight:for:
+            h isNil ifTrue:[ eachChild height: 0. h :=  eachChild computePreferredExtent y. ].  
+            eachChild height: h
+        ].
     ].
-    mustRearrange := true.
     self setChildPositions.
     mustRearrange := false.
 !
 
 storePreferredHeight: aHeight for: aView
-    (aView isView and:[aView superView == self])
-       ifFalse:[ ^ self ].
-
-    "/ only used for windows
-    OperatingSystem isMSWINDOWSlike ifFalse:[ ^ self ].
+    "called by UISpecification #buildViewWithLayoutFor to setup up a specific view"
 
-    storedPreferredHeight isNil ifTrue:[storedPreferredHeight := IdentityDictionary new ].
-    
-    (aHeight isInteger and:[aHeight > 0 ])
-        ifTrue: [ storedPreferredHeight at: aView put: aHeight ]
-        ifFalse:[ storedPreferredHeight removeKey: aView ifAbsent: nil ].
+    OperatingSystem isMSWINDOWSlike ifFalse:[ ^ self ].   "/ supported only for windows!!!!
+
+    (aView isView and:[aHeight isInteger and:[aHeight > 0]])
+        ifTrue:[ aView setAttribute:#VerticalPanelPreferredHeight to: aHeight ].  "/ see: #beVisiblePostUpdate
 ! !
 
 !VerticalPanelView methodsFor:'layout'!