ConvertedValue.st
changeset 90 59d4413a8c39
child 96 948318b2fbd4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ConvertedValue.st	Thu Aug 24 22:37:54 1995 +0200
@@ -0,0 +1,63 @@
+'From Smalltalk/X, Version:2.10.7 on 24-aug-1995 at 8:28:49'                    !
+
+ValueHolder subclass:#ConvertedValue
+	 instanceVariableNames:'conversion'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Interface-Support-Channels'
+!
+
+!ConvertedValue class methodsFor:'documentation'!
+
+version
+"
+$Header: /cvs/stx/stx/libview2/ConvertedValue.st,v 1.1 1995-08-24 20:37:54 claus Exp $
+"
+!
+
+documentation
+"
+    a ConvertedValue translates changes on input via a conversion block
+    to the output. For example, if you want to have a toggle to change the
+    color inputs of some other labels, use a convertedValue which translates
+    true/false into colors:
+
+	|toggle label converter|
+
+	converter := ConvertedValue new
+			conversion:[:input | input == true
+						ifTrue:[Color red]
+						ifFalse:[Color blue]];
+			value:false.
+        
+
+	toggle := Toggle label:'change color'.
+	toggle controller pressChannel:converter.
+
+	label := Label label:'see me changing'.
+	label foregroundChannel:converter.
+
+	toggle open.
+	label open.
+"
+!
+
+examples
+"
+    examples to be added.
+"
+! !
+
+!ConvertedValue methodsFor:'accessing'!
+
+conversion:aBlock 
+    conversion := aBlock
+!
+
+initialValue:someValue
+    self value:someValue
+!
+
+value:input
+    ^ super value:(conversion value:input)
+! !