class: EnterBox
authorClaus Gittinger <cg@exept.de>
Fri, 27 Feb 2015 17:06:48 +0100
changeset 5291 c51e42b3d311
parent 5290 6e5158a5c59b
child 5292 2b847f6bd8f8
class: EnterBox changed: #preferredExtent let superclass do the computation (which is correct when components are added dynamically)
EnterBox.st
--- a/EnterBox.st	Fri Feb 27 16:32:55 2015 +0100
+++ b/EnterBox.st	Fri Feb 27 17:06:48 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1990 by Claus Gittinger
 	      All Rights Reserved
@@ -583,39 +585,43 @@
     |wWanted hWanted wPanel vs2 min 
      labelPref enterPref panelPref|
 
-    "/ If I have an explicit preferredExtent..
-    explicitExtent notNil ifTrue:[
-        ^ explicitExtent
-    ].
-
-    "/ If I have a cached preferredExtent value..
-    preferredExtent notNil ifTrue:[
-        ^ preferredExtent
-    ].
+    "/ works perfectly well - and actually correct,
+    "/ if components are added via dialog opening interception
+    ^ super preferredExtent.
 
-    panelPref := buttonPanel preferredExtent.
-    labelPref := labelField preferredExtent.
-    enterPref := enterField preferredExtent.
-    wWanted := (labelPref x max:enterPref x).
-    wPanel := panelPref x.
-    wPanel > wWanted ifTrue:[
-        wWanted := wPanel
-    ].
-    hWanted := labelPref y + ViewSpacing + enterPref y +
-               ViewSpacing + panelPref y + ViewSpacing.
-    verticalPanel notNil ifTrue:[
-        hWanted := hWanted + ViewSpacing + (verticalPanel preferredHeight). 
-    ].
-
-    min := self class minExtent.
-    wWanted <  min x ifTrue:[
-        wWanted :=  min x
-    ].
-    hWanted <  min y ifTrue:[
-        hWanted :=  min y
-    ].
-    vs2 := ViewSpacing * 2.
-    ^ (wWanted + vs2) @ (hWanted + vs2)
+"/    "/ If I have an explicit preferredExtent..
+"/    explicitExtent notNil ifTrue:[
+"/        ^ explicitExtent
+"/    ].
+"/
+"/    "/ If I have a cached preferredExtent value..
+"/    preferredExtent notNil ifTrue:[
+"/        ^ preferredExtent
+"/    ].
+"/
+"/    panelPref := buttonPanel preferredExtent.
+"/    labelPref := labelField preferredExtent.
+"/    enterPref := enterField preferredExtent.
+"/    wWanted := (labelPref x max:enterPref x).
+"/    wPanel := panelPref x.
+"/    wPanel > wWanted ifTrue:[
+"/        wWanted := wPanel
+"/    ].
+"/    hWanted := labelPref y + ViewSpacing + enterPref y +
+"/               ViewSpacing + panelPref y + ViewSpacing.
+"/    verticalPanel notNil ifTrue:[
+"/        hWanted := hWanted + ViewSpacing + (verticalPanel preferredHeight). 
+"/    ].
+"/
+"/    min := self class minExtent.
+"/    wWanted <  min x ifTrue:[
+"/        wWanted :=  min x
+"/    ].
+"/    hWanted <  min y ifTrue:[
+"/        hWanted :=  min y
+"/    ].
+"/    vs2 := ViewSpacing * 2.
+"/    ^ (wWanted + vs2) @ (hWanted + vs2)      
 
     "Modified: / 22.1.1998 / 09:57:55 / md"
     "Modified: / 27.7.1998 / 20:18:41 / cg"
@@ -725,10 +731,10 @@
 !EnterBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.72 2015-02-27 13:33:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.73 2015-02-27 16:06:48 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.72 2015-02-27 13:33:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.73 2015-02-27 16:06:48 cg Exp $'
 ! !