--- a/DialogBox.st Sat Nov 10 00:05:26 2018 +0100
+++ b/DialogBox.st Sat Nov 10 00:05:37 2018 +0100
@@ -8483,7 +8483,7 @@
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
buttonPanel topInset:h negated
].
- preferredExtent := nil.
+ self flushCachedPreferredExtent.
needResize := true.
^ aButton
@@ -8527,7 +8527,8 @@
dialog accepted ifTrue:[Transcript showCR:'yes'].
"
- "Modified: 9.2.1996 / 22:13:51 / cg"
+ "Modified: / 09-02-1996 / 22:13:51 / cg"
+ "Modified: / 09-11-2018 / 20:14:23 / Claus Gittinger"
!
addButton:aButton before:someOtherButtonOrNil
@@ -8544,7 +8545,7 @@
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[
buttonPanel topInset:h negated
].
- preferredExtent := nil.
+ self flushCachedPreferredExtent.
needResize := true.
shown ifTrue:[ aButton realize ].
^ aButton
@@ -8576,8 +8577,9 @@
dialog accepted ifTrue:[Transcript showCR:'yes'].
"
- "Modified: 9.2.1996 / 22:13:51 / cg"
- "Created: 10.2.1996 / 16:04:35 / cg"
+ "Modified: / 09-02-1996 / 22:13:51 / cg"
+ "Created: / 10-02-1996 / 16:04:35 / cg"
+ "Modified: / 09-11-2018 / 20:14:28 / Claus Gittinger"
!
addHelpButtonFor:pathToHelpText
@@ -10623,9 +10625,11 @@
addedComponents add:aComponent.
self addSubView:aComponent.
+ "/ must flush any cached preferredExtent, when a component is added (for example, in an aboutToOpen callBack)
+ self flushCachedPreferredExtent.
needResize := true.
- "/ must flush any cached preferredExtent, when a component is added (for example, in an aboutToOpen callBack)
- preferredExtent := nil.
+
+ "Modified: / 09-11-2018 / 20:14:47 / Claus Gittinger"
!
forceResize
@@ -10678,7 +10682,7 @@
) ifTrue:[
verticalPanel extent:verticalPanel preferredExtent.
].
- preferredExtent := nil.
+ self flushCachedPreferredExtent.
self extent:(self preferredExtent).
].
@@ -10696,6 +10700,7 @@
].
"Modified: / 24-08-2017 / 16:39:51 / cg"
+ "Modified: / 09-11-2018 / 20:15:03 / Claus Gittinger"
!
resize
@@ -10722,6 +10727,60 @@
^ acceptValue value
!
+computePreferredExtent
+ "return my preferred extent.
+ That is the max component width, or my current width (default);
+ whichever is larger, by the sum of the component's heights."
+
+ |w h p vPanelExt vPanelHeight|
+
+ h := yPosition + ViewSpacing.
+ verticalPanel notNil ifTrue:[
+ "/ because the vertical panels size was not known until now,
+ "/ it was not counted in the y-position yet.
+ "/ Do this now.
+ vPanelExt := verticalPanel computePreferredExtent.
+ vPanelHeight := vPanelExt y.
+
+ "/ verticalPanel extent:vPanelExt.
+ "/ vPanelHeight := verticalPanel height.
+
+ h := h + vPanelHeight.
+ ].
+
+ addedComponents notNil ifTrue:[
+ w := self maxPreferredWidthOfAddedComponents.
+ ] ifFalse:[
+ w := super computePreferredExtent x.
+ ].
+ w := w max:width.
+
+ subViews size ~~ 0 ifTrue:[
+ p := buttonPanel preferredExtent.
+ w := w max:p x.
+ h := h
+ + p y
+ + ViewSpacing.
+ ].
+
+ verticalPanel notNil ifTrue:[
+ w := w max:vPanelExt x.
+ ].
+
+"/ okButton isNil ifTrue:[
+"/ ^ super preferredExtent
+"/ ].
+"/ p := buttonPanel preferredExtent.
+"/ w := p x.
+"/ h := ViewSpacing
+"/ + p y
+"/ + ViewSpacing.
+"/
+ ^ w @ h
+
+ "Created: / 09-11-2018 / 19:50:59 / Claus Gittinger"
+!
+
interfaceSpecFor:aSelector
"return an interface spec.
Notice - Dialog should be moved under AppModel so this becomes obsolete."
@@ -10790,70 +10849,6 @@
"Modified: 16.1.1997 / 22:00:23 / cg"
!
-preferredExtent
- "return my preferred extent.
- That is the max component width, or my current width (default);
- whichever is larger, by the sum of the component's heights."
-
- |w h p vPanelExt vPanelHeight|
-
- "/ If I have an explicit preferredExtent..
- explicitExtent notNil ifTrue:[
- ^ explicitExtent
- ].
-
- "/ If I have a cached preferredExtent value..
- preferredExtent notNil ifTrue:[
- ^ preferredExtent
- ].
-
- h := yPosition + ViewSpacing.
- verticalPanel notNil ifTrue:[
- "/ because the vertical panels size was not known until now,
- "/ it was not counted in the y-position yet.
- "/ Do this now.
- vPanelExt := verticalPanel computePreferredExtent.
- vPanelHeight := vPanelExt y.
-
- "/ verticalPanel extent:vPanelExt.
- "/ vPanelHeight := verticalPanel height.
-
- h := h + vPanelHeight.
- ].
-
- addedComponents notNil ifTrue:[
- w := self maxPreferredWidthOfAddedComponents.
- ] ifFalse:[
- w := super preferredExtent x.
- ].
- w := w max:width.
-
- subViews size ~~ 0 ifTrue:[
- p := buttonPanel preferredExtent.
- w := w max:p x.
- h := h
- + p y
- + ViewSpacing.
- ].
-
- verticalPanel notNil ifTrue:[
- w := w max:vPanelExt x.
- ].
-
-"/ okButton isNil ifTrue:[
-"/ ^ super preferredExtent
-"/ ].
-"/ p := buttonPanel preferredExtent.
-"/ w := p x.
-"/ h := ViewSpacing
-"/ + p y
-"/ + ViewSpacing.
-"/
- ^ w @ h
-
- "Modified: / 22-10-2017 / 01:29:03 / cg"
-!
-
specificationFor:aKey
"return an interface spec's literal encoding.
Notice - Dialog should be moved under AppModel so this becomes obsolete."