author | Claus Gittinger <cg@exept.de> |
Thu, 25 Apr 1996 18:32:07 +0200 | |
changeset 221 | ea942fe5dc04 |
parent 114 | e577a2f332d0 |
child 258 | 9d218cd753c0 |
permissions | -rw-r--r-- |
90 | 1 |
'From Smalltalk/X, Version:2.10.7 on 24-aug-1995 at 8:28:49' ! |
2 |
||
3 |
ValueHolder subclass:#ConvertedValue |
|
4 |
instanceVariableNames:'conversion' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Interface-Support-Channels' |
|
8 |
! |
|
9 |
||
10 |
!ConvertedValue class methodsFor:'documentation'! |
|
11 |
||
12 |
version |
|
114
e577a2f332d0
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
96
diff
changeset
|
13 |
^ '$Header: /cvs/stx/stx/libview2/Attic/ConvValue.st,v 1.3 1995-11-11 16:04:22 cg Exp $' |
90 | 14 |
! |
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
a ConvertedValue translates changes on input via a conversion block |
|
19 |
to the output. For example, if you want to have a toggle to change the |
|
20 |
color inputs of some other labels, use a convertedValue which translates |
|
21 |
true/false into colors: |
|
22 |
||
23 |
|toggle label converter| |
|
24 |
||
25 |
converter := ConvertedValue new |
|
26 |
conversion:[:input | input == true |
|
27 |
ifTrue:[Color red] |
|
28 |
ifFalse:[Color blue]]; |
|
29 |
value:false. |
|
30 |
||
31 |
||
32 |
toggle := Toggle label:'change color'. |
|
33 |
toggle controller pressChannel:converter. |
|
34 |
||
35 |
label := Label label:'see me changing'. |
|
36 |
label foregroundChannel:converter. |
|
37 |
||
38 |
toggle open. |
|
39 |
label open. |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
examples |
|
44 |
" |
|
45 |
examples to be added. |
|
46 |
" |
|
47 |
! ! |
|
48 |
||
49 |
!ConvertedValue methodsFor:'accessing'! |
|
50 |
||
51 |
conversion:aBlock |
|
52 |
conversion := aBlock |
|
53 |
! |
|
54 |
||
55 |
initialValue:someValue |
|
56 |
self value:someValue |
|
57 |
! |
|
58 |
||
59 |
value:input |
|
60 |
^ super value:(conversion value:input) |
|
61 |
! ! |