author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 17:05:49 +0100 | |
changeset 114 | e577a2f332d0 |
parent 96 | 948318b2fbd4 |
child 125 | fa5b5e4336bf |
permissions | -rw-r--r-- |
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 |
" |
|
12 |
||
13 |
'From Smalltalk/X, Version:2.10.5 on 11-may-1995 at 4:39:48 am'! |
|
14 |
||
15 |
ValueHolder subclass:#TriggerValue |
|
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Support-Models' |
|
20 |
! |
|
21 |
||
22 |
!TriggerValue class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
version |
|
114
e577a2f332d0
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
96
diff
changeset
|
39 |
^ '$Header: /cvs/stx/stx/libview2/TriggerValue.st,v 1.4 1995-11-11 16:05:19 cg Exp $' |
80 | 40 |
! |
41 |
||
42 |
examples |
|
43 |
" |
|
44 |
buffered editing with a TriggerValue |
|
45 |
||
46 |
|firstName lastName trigger dialog| |
|
47 |
||
48 |
firstName := 'foo' asValue. |
|
49 |
lastName := 'bar' asValue. |
|
50 |
trigger := TriggerValue new. |
|
51 |
||
52 |
dialog := Dialog new. |
|
53 |
(dialog addTextLabel:'Name:') layout:#left. |
|
54 |
(dialog addInputFieldOn:(BufferedValueHolder |
|
55 |
subject:firstName |
|
56 |
triggerChannel:trigger)) immediateAccept:true. |
|
57 |
dialog addVerticalSpace. |
|
58 |
(dialog addTextLabel:'Address:') layout:#left. |
|
59 |
(dialog addInputFieldOn:(BufferedValueHolder |
|
60 |
subject:lastName |
|
61 |
triggerChannel:trigger)) immediateAccept:true. |
|
62 |
||
63 |
dialog addAbortButton; |
|
64 |
addButton:(Button new |
|
65 |
label:'undo'; |
|
66 |
action:[trigger value:false]); |
|
67 |
addOkButton. |
|
68 |
||
69 |
dialog okAction:[trigger value:true]. |
|
70 |
dialog open. |
|
71 |
||
72 |
Transcript show:firstName value; show:' '; showCr:lastName value |
|
73 |
" |
|
74 |
! |
|
75 |
||
76 |
documentation |
|
77 |
" |
|
78 |
a triggerValue sends updates on every store of a value, even if the same |
|
79 |
value is stored again. |
|
80 |
It can be used as a triggerChannel of a bufferedValueHolder. |
|
81 |
||
82 |
(however, in this specific use, you can also use normal ValueHolder, |
|
83 |
and set it value to nil before setting it to the actual trigger value) |
|
84 |
" |
|
85 |
! ! |
|
86 |
||
87 |
!TriggerValue methodsFor:'accessing'! |
|
88 |
||
89 |
value:anObject |
|
90 |
"redefined to send change notifications on every store" |
|
91 |
||
92 |
self setValue:anObject. |
|
86 | 93 |
"/ self notifyChange:#value |
94 |
self changed:#value |
|
80 | 95 |
! ! |
96 |