*** empty log message ***
authorwerner
Wed, 07 Apr 2004 14:52:44 +0200
changeset 2963 14df9998d682
parent 2962 f466b7d4e881
child 2964 b6d4c737970f
*** empty log message ***
Toggle.st
--- a/Toggle.st	Wed Apr 07 10:32:20 2004 +0200
+++ b/Toggle.st	Wed Apr 07 14:52:44 2004 +0200
@@ -507,6 +507,10 @@
 
 !Toggle methodsFor:'private'!
 
+asBoolean:aModelValue
+    ^ aModelValue
+!
+
 computeLabelOrigin
     "compute the origin of the form/text.
      redefined to move label to the right if there is a lamp."
@@ -538,8 +542,12 @@
     |val|
 
     (model notNil and:[aspectMsg notNil]) ifTrue:[
-        val := model perform:aspectMsg withOptionalArgument:self.
-        val == true ifTrue:[  "allowing nil - treat as false"
+        aspectMsg == #value ifTrue:[
+            val := model value   "/ faster call
+        ] ifFalse:[
+            val := model perform:aspectMsg withOptionalArgument:self.
+        ].
+        (self asBoolean:val) == true ifTrue:[  "allowing nil - treat as false"
             self turnOn
         ] ifFalse:[
             self turnOff
@@ -636,5 +644,5 @@
 !Toggle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.49 2004-04-02 17:29:23 werner Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.50 2004-04-07 12:52:44 werner Exp $'
 ! !