80
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
3383
|
12 |
"{ Package: 'stx:libview2' }"
|
80
|
13 |
|
|
14 |
ValueHolder subclass:#TriggerValue
|
223
|
15 |
instanceVariableNames:''
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Interface-Support-Models'
|
80
|
19 |
!
|
|
20 |
|
|
21 |
!TriggerValue class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
125
|
37 |
documentation
|
|
38 |
"
|
|
39 |
a triggerValue sends updates on every store of a value, even if the same
|
|
40 |
value is stored again.
|
|
41 |
It can be used as a triggerChannel of a bufferedValueHolder.
|
|
42 |
|
|
43 |
(however, in this specific use, you can also use normal ValueHolder,
|
|
44 |
and set it value to nil before setting it to the actual trigger value)
|
223
|
45 |
|
|
46 |
[author:]
|
|
47 |
Claus Gittinger
|
125
|
48 |
"
|
80
|
49 |
!
|
|
50 |
|
|
51 |
examples
|
|
52 |
"
|
3383
|
53 |
[exBegin]
|
|
54 |
|trigger|
|
|
55 |
|
|
56 |
trigger := TriggerValue new.
|
|
57 |
trigger onChangeEvaluate:[ Transcript showCR:'hello' ].
|
|
58 |
trigger value:true.
|
|
59 |
Delay waitForSeconds:1.
|
|
60 |
trigger value:true
|
|
61 |
[exEnd]
|
|
62 |
|
80
|
63 |
buffered editing with a TriggerValue
|
231
|
64 |
[exBegin]
|
|
65 |
|firstName lastName trigger dialog|
|
80
|
66 |
|
231
|
67 |
firstName := 'foo' asValue.
|
|
68 |
lastName := 'bar' asValue.
|
|
69 |
trigger := TriggerValue new.
|
80
|
70 |
|
231
|
71 |
dialog := Dialog new.
|
|
72 |
(dialog addTextLabel:'Name:') layout:#left.
|
|
73 |
(dialog addInputFieldOn:(BufferedValueHolder
|
|
74 |
subject:firstName
|
|
75 |
triggerChannel:trigger)) immediateAccept:true.
|
|
76 |
dialog addVerticalSpace.
|
|
77 |
(dialog addTextLabel:'Address:') layout:#left.
|
|
78 |
(dialog addInputFieldOn:(BufferedValueHolder
|
|
79 |
subject:lastName
|
|
80 |
triggerChannel:trigger)) immediateAccept:true.
|
80
|
81 |
|
231
|
82 |
dialog addAbortButton;
|
|
83 |
addButton:(Button new
|
|
84 |
label:'undo';
|
|
85 |
action:[trigger value:false]);
|
|
86 |
addOkButton.
|
80
|
87 |
|
231
|
88 |
dialog okAction:[trigger value:true].
|
|
89 |
dialog open.
|
80
|
90 |
|
268
|
91 |
Transcript show:firstName value; show:' '; showCR:lastName value
|
231
|
92 |
[exEnd]
|
80
|
93 |
"
|
|
94 |
! !
|
|
95 |
|
|
96 |
!TriggerValue methodsFor:'accessing'!
|
|
97 |
|
|
98 |
value:anObject
|
1008
|
99 |
"redefined to send change notifications on every store,
|
|
100 |
even if the same value is stored again."
|
80
|
101 |
|
|
102 |
self setValue:anObject.
|
86
|
103 |
self changed:#value
|
1008
|
104 |
|
|
105 |
"Modified: / 28.7.1998 / 11:22:32 / cg"
|
80
|
106 |
! !
|
|
107 |
|
129
|
108 |
!TriggerValue class methodsFor:'documentation'!
|
|
109 |
|
|
110 |
version
|
3383
|
111 |
^ '$Header: /cvs/stx/stx/libview2/TriggerValue.st,v 1.11 2014-11-14 11:40:20 cg Exp $'
|
129
|
112 |
! !
|
3383
|
113 |
|