ViewWithAcceptAndCancelBar.st
changeset 19454 6195b98dafdd
parent 19437 4ea45267ecb7
--- a/ViewWithAcceptAndCancelBar.st	Wed Feb 05 19:08:02 2020 +0100
+++ b/ViewWithAcceptAndCancelBar.st	Thu Feb 06 21:25:49 2020 +0100
@@ -17,7 +17,7 @@
 
 SimpleView subclass:#ViewWithAcceptAndCancelBar
 	instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction
-		compareAction'
+		compareAction barShown'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Basic'
@@ -132,15 +132,21 @@
 !ViewWithAcceptAndCancelBar methodsFor:'change & update'!
 
 hideBar
-    bar unmap.
-    bar hiddenOnRealize:true.
-    slaveView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+    barShown ifTrue:[
+        bar unmap.
+        bar hiddenOnRealize:true.
+        slaveView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+        barShown := false.
+    ]
 !
 
 showBar
-    slaveView origin:(20 @ 0.0) corner:(1.0 @ 1.0).
-    bar hiddenOnRealize:false.
-    bar realize.
+    barShown ifFalse:[
+        slaveView origin:(20 @ 0.0) corner:(1.0 @ 1.0).
+        bar hiddenOnRealize:false.
+        bar realize.
+        barShown := true.
+    ].
 !
 
 update:something with:aParameter from:changedObject
@@ -188,6 +194,7 @@
     bar := AcceptAndCancelBar in:self.
     bar origin:(0.0 @ 0.0) corner:(20 @ 1.0).
     bar hiddenOnRealize:true.
+    barShown := false.
 
     bar acceptButton action:[ self accept ].
     bar cancelButton action:[ self cancel ].