--- 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 $'
! !