Toggle.st
changeset 7 15a9291b9bd0
parent 5 7b4fb1b170e5
child 22 ac872628ef2d
--- a/Toggle.st	Sat Dec 11 02:41:07 1993 +0100
+++ b/Toggle.st	Sat Dec 11 02:51:34 1993 +0100
@@ -26,7 +26,7 @@
 again. All the main action is in Button, Toggle just redefines buttonpress/
 release behavior.
 
-$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.3 1993-10-13 02:49:46 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.4 1993-12-11 01:50:32 claus Exp $
 written spring/summer 89 by claus
 '!
 
@@ -37,22 +37,27 @@
      under program control (i.e. turn one toggle off from another one)"
 
     pressed := pressed not.
+    pressed ifTrue:[
+        self level:onLevel.
+    ] ifFalse:[
+        self level:offLevel.
+    ].
     self redraw
 !
 
 toggle
     "toggle and perform the action"
 
+    |action|
+
     enabled ifTrue:[
-        pressed := pressed not.
+        self toggleNoAction.
         pressed ifTrue:[
-            self level:onLevel.
-            pressActionBlock notNil ifTrue:[pressActionBlock value]
+            action := pressActionBlock
         ] ifFalse:[
-            self level:offLevel.
-            releaseActionBlock notNil ifTrue:[releaseActionBlock value]
+            action := releaseActionBlock
         ].
-        self redraw
+        action notNil ifTrue:[action value]
     ]
 ! !