when changing the trigger-on setting,
authorClaus Gittinger <cg@exept.de>
Thu, 08 Feb 2001 17:24:47 +0100
changeset 2345 3b69631b179b
parent 2344 da0c69b10f2f
child 2346 09513d738f39
when changing the trigger-on setting, also change press/releaseAction, if already set
ButtonController.st
--- a/ButtonController.st	Thu Feb 08 11:40:07 2001 +0100
+++ b/ButtonController.st	Thu Feb 08 17:24:47 2001 +0100
@@ -162,6 +162,14 @@
 beButton
     "make the receiver act like a button; thats the default, anyway"
 
+    "/ because I will be a trigger-on-up button
+    (isTriggerOnDown 
+    and:[pressActionBlock notNil 
+    and:[releaseActionBlock isNil]]) ifTrue:[
+        pressActionBlock := releaseActionBlock.
+        releaseActionBlock := nil.
+    ].
+
     isTriggerOnDown := false.
     isToggle := false.
     isRadio := false.
@@ -175,16 +183,30 @@
      That is like a toggle, but do not allow turning myself off
      by buttonPress (instead, must be turned off by another button or programmatically)"
 
+    "/ because I will be a trigger-on-down button
+    (isTriggerOnDown not 
+    and:[releaseActionBlock notNil 
+    and:[pressActionBlock isNil]]) ifTrue:[
+        pressActionBlock := releaseActionBlock.
+        releaseActionBlock := nil.
+    ].
+
     isTriggerOnDown := true.
     isToggle := false.
     isRadio := true.
-
-    "Created: 15.7.1996 / 13:42:06 / cg"
 !
 
 beToggle
     "make the receiver act like a toggle"
 
+    "/ because I will be a trigger-on-down button
+    (isTriggerOnDown not 
+    and:[releaseActionBlock notNil 
+    and:[pressActionBlock isNil]]) ifTrue:[
+        pressActionBlock := releaseActionBlock.
+        releaseActionBlock := nil.
+    ].
+
     isTriggerOnDown := true.
     isToggle := true.
     isRadio := false.
@@ -767,5 +789,5 @@
 !ButtonController class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.63 2000-11-17 09:26:48 martin Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.64 2001-02-08 16:24:47 cg Exp $'
 ! !