TriggerValue.st
changeset 80 e029e7deed8b
child 86 38cc61653cb2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TriggerValue.st	Tue Jun 06 06:10:38 1995 +0200
@@ -0,0 +1,97 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+'From Smalltalk/X, Version:2.10.5 on 11-may-1995 at 4:39:48 am'!
+
+ValueHolder subclass:#TriggerValue
+	 instanceVariableNames:''
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Interface-Support-Models'
+!
+
+!TriggerValue class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview2/TriggerValue.st,v 1.1 1995-06-06 04:09:10 claus Exp $
+"
+!
+
+examples 
+"
+    buffered editing with a TriggerValue
+
+	|firstName lastName trigger dialog|
+
+	firstName :=  'foo' asValue.
+	lastName := 'bar' asValue.
+	trigger := TriggerValue new.
+
+	dialog := Dialog new.
+	(dialog addTextLabel:'Name:') layout:#left.
+	(dialog addInputFieldOn:(BufferedValueHolder
+				    subject:firstName
+				    triggerChannel:trigger)) immediateAccept:true.
+	dialog addVerticalSpace.
+	(dialog addTextLabel:'Address:') layout:#left.
+	(dialog addInputFieldOn:(BufferedValueHolder
+				    subject:lastName
+				    triggerChannel:trigger)) immediateAccept:true.
+
+	dialog addAbortButton; 
+	       addButton:(Button new 
+				label:'undo'; 
+				action:[trigger value:false]);
+	       addOkButton.
+
+	dialog okAction:[trigger value:true].
+	dialog open.
+
+	Transcript show:firstName value; show:' '; showCr:lastName value
+"
+!
+
+documentation
+"
+    a triggerValue sends updates on every store of a value, even if the same
+    value is stored again.
+    It can be used as a triggerChannel of a bufferedValueHolder.
+
+    (however, in this specific use, you can also use normal ValueHolder,
+     and set it value to nil before setting it to the actual trigger value)
+"
+! !
+
+!TriggerValue methodsFor:'accessing'!
+
+value:anObject
+    "redefined to send change notifications on every store"
+
+    self setValue:anObject.
+    self notifyChange:#value
+! !
+