examples
authorClaus Gittinger <cg@exept.de>
Sat, 27 Apr 1996 19:56:29 +0200
changeset 620 c840b7106a64
parent 619 a46cb2ef56bf
child 621 decaeae1910d
examples
KeybdFwd.st
KeyboardForwarder.st
ResourcePack.st
RsrcPack.st
--- a/KeybdFwd.st	Sat Apr 27 19:53:57 1996 +0200
+++ b/KeybdFwd.st	Sat Apr 27 19:56:29 1996 +0200
@@ -103,63 +103,66 @@
 examples
 "
     catch an enterfields input:
-
-	|top field forwarder catcher|
+                                                                        [exBegin]
+        |top field forwarder catcher|
 
-	catcher := Plug new.
-	catcher respondTo:#keyPress:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought keyPress: ' , key printString.].
-	catcher respondTo:#keyRelease:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought keyRelease: ' , key printString.].
+        catcher := Plug new.
+        catcher respondTo:#keyPress:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought keyPress: ' , key printString.].
+        catcher respondTo:#keyRelease:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought keyRelease: ' , key printString.].
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
+
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        forwarder := KeyboardForwarder to:catcher. 
+        field delegate:forwarder.
 
-	forwarder := KeyboardForwarder to:catcher. 
-	field delegate:forwarder.
-
-	top open
+        top open
+                                                                        [exEnd]
 
 
     catch an enterfields return-key only:
-
-	|top field forwarder catcher|
+                                                                        [exBegin]
+        |top field forwarder catcher|
 
-	catcher := Plug new.
-	catcher respondTo:#keyPress:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought return'].
+        catcher := Plug new.
+        catcher respondTo:#keyPress:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought return'].
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	forwarder := KeyboardForwarder 
-			to:catcher 
-			condition:[:type :key :view | (type == #keyPress) & (key == #Return)].
-	field delegate:forwarder.
+        forwarder := KeyboardForwarder 
+                        to:catcher 
+                        condition:[:type :key :view | (type == #keyPress) & (key == #Return)].
+        field delegate:forwarder.
 
-	top open
+        top open
+                                                                        [exEnd]
 
 
     catch all of an enterfields input and ignore it:
-
-	|top field forwarder|
+                                                                        [exBegin]
+        |top field forwarder|
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	forwarder := KeyboardForwarder to:nil. 
-	field delegate:forwarder.
+        forwarder := KeyboardForwarder to:nil. 
+        field delegate:forwarder.
 
-	top open
+        top open
+                                                                        [exEnd]
 "
 ! !
 
@@ -428,5 +431,5 @@
 !KeyboardForwarder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/KeybdFwd.st,v 1.14 1996-04-25 16:33:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/KeybdFwd.st,v 1.15 1996-04-27 17:56:29 cg Exp $'
 ! !
--- a/KeyboardForwarder.st	Sat Apr 27 19:53:57 1996 +0200
+++ b/KeyboardForwarder.st	Sat Apr 27 19:56:29 1996 +0200
@@ -103,63 +103,66 @@
 examples
 "
     catch an enterfields input:
-
-	|top field forwarder catcher|
+                                                                        [exBegin]
+        |top field forwarder catcher|
 
-	catcher := Plug new.
-	catcher respondTo:#keyPress:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought keyPress: ' , key printString.].
-	catcher respondTo:#keyRelease:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought keyRelease: ' , key printString.].
+        catcher := Plug new.
+        catcher respondTo:#keyPress:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought keyPress: ' , key printString.].
+        catcher respondTo:#keyRelease:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought keyRelease: ' , key printString.].
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
+
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        forwarder := KeyboardForwarder to:catcher. 
+        field delegate:forwarder.
 
-	forwarder := KeyboardForwarder to:catcher. 
-	field delegate:forwarder.
-
-	top open
+        top open
+                                                                        [exEnd]
 
 
     catch an enterfields return-key only:
-
-	|top field forwarder catcher|
+                                                                        [exBegin]
+        |top field forwarder catcher|
 
-	catcher := Plug new.
-	catcher respondTo:#keyPress:x:y:view:
-		    with:[:key :x :y :view | Transcript showCr:'cought return'].
+        catcher := Plug new.
+        catcher respondTo:#keyPress:x:y:view:
+                    with:[:key :x :y :view | Transcript showCr:'cought return'].
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	forwarder := KeyboardForwarder 
-			to:catcher 
-			condition:[:type :key :view | (type == #keyPress) & (key == #Return)].
-	field delegate:forwarder.
+        forwarder := KeyboardForwarder 
+                        to:catcher 
+                        condition:[:type :key :view | (type == #keyPress) & (key == #Return)].
+        field delegate:forwarder.
 
-	top open
+        top open
+                                                                        [exEnd]
 
 
     catch all of an enterfields input and ignore it:
-
-	|top field forwarder|
+                                                                        [exBegin]
+        |top field forwarder|
 
-	top := StandardSystemView new.
-	top extent:200@200.
+        top := StandardSystemView new.
+        top extent:200@200.
 
-	field := EditField in:top.
-	field origin:0.0@0.0; width:1.0.
+        field := EditField in:top.
+        field origin:0.0@0.0; width:1.0.
 
-	forwarder := KeyboardForwarder to:nil. 
-	field delegate:forwarder.
+        forwarder := KeyboardForwarder to:nil. 
+        field delegate:forwarder.
 
-	top open
+        top open
+                                                                        [exEnd]
 "
 ! !
 
@@ -428,5 +431,5 @@
 !KeyboardForwarder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/KeyboardForwarder.st,v 1.14 1996-04-25 16:33:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/KeyboardForwarder.st,v 1.15 1996-04-27 17:56:29 cg Exp $'
 ! !
--- a/ResourcePack.st	Sat Apr 27 19:53:57 1996 +0200
+++ b/ResourcePack.st	Sat Apr 27 19:56:29 1996 +0200
@@ -121,11 +121,11 @@
     normally, resources are found in files named after their classes sourcefile
     For example, the FileBrowsers resources are found in 'FBrowser.rs'.
     For the examples below, we process resources from a constant string;
-	this is NOT representative.
+        this is NOT representative.
+                                                                        [exBegin]
+        |stream res|
 
-	|stream res|
-
-	stream := ReadStream on:'
+        stream := ReadStream on:'
 foo  ''the translation for foo''
 #if Language == #german
 bar  ''die deutsche uebersetzung von bar''
@@ -138,21 +138,26 @@
 
 '.
 
-	res := ResourcePack new readFromResourceStream:stream in:nil.
+        res := ResourcePack new readFromResourceStream:stream in:nil.
 
-	Transcript showCr:'baz is translated to: ' , (res string:'baz' with:'1234').
-	Transcript showCr:'bar is translated to: ' , (res string:'bar').
-	Transcript showCr:'foo is translated to: ' , (res string:'foo').
-	Transcript showCr:'fooBar is translated to: ' , (res string:'fooBar').
-
+        Transcript showCr:'baz is translated to: ' , (res string:'baz' with:'1234').
+        Transcript showCr:'bar is translated to: ' , (res string:'bar').
+        Transcript showCr:'foo is translated to: ' , (res string:'foo').
+        Transcript showCr:'fooBar is translated to: ' , (res string:'fooBar').
+                                                                        [exEnd]
     set the Language to french:
-
-	Language := #french
-
+                                                                        [exBegin]
+        Language := #french
+                                                                        [exEnd]
     and repeat the above.
-
-	Language := #english 
-	Language := #german 
+    back to english:
+                                                                        [exBegin]
+        Language := #english 
+                                                                        [exEnd]
+    back to german:
+                                                                        [exBegin]
+        Language := #german 
+                                                                        [exEnd]
 "
 ! !
 
@@ -551,6 +556,6 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.28 1996-04-25 16:33:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.29 1996-04-27 17:56:19 cg Exp $'
 ! !
 ResourcePack initialize!
--- a/RsrcPack.st	Sat Apr 27 19:53:57 1996 +0200
+++ b/RsrcPack.st	Sat Apr 27 19:56:29 1996 +0200
@@ -121,11 +121,11 @@
     normally, resources are found in files named after their classes sourcefile
     For example, the FileBrowsers resources are found in 'FBrowser.rs'.
     For the examples below, we process resources from a constant string;
-	this is NOT representative.
+        this is NOT representative.
+                                                                        [exBegin]
+        |stream res|
 
-	|stream res|
-
-	stream := ReadStream on:'
+        stream := ReadStream on:'
 foo  ''the translation for foo''
 #if Language == #german
 bar  ''die deutsche uebersetzung von bar''
@@ -138,21 +138,26 @@
 
 '.
 
-	res := ResourcePack new readFromResourceStream:stream in:nil.
+        res := ResourcePack new readFromResourceStream:stream in:nil.
 
-	Transcript showCr:'baz is translated to: ' , (res string:'baz' with:'1234').
-	Transcript showCr:'bar is translated to: ' , (res string:'bar').
-	Transcript showCr:'foo is translated to: ' , (res string:'foo').
-	Transcript showCr:'fooBar is translated to: ' , (res string:'fooBar').
-
+        Transcript showCr:'baz is translated to: ' , (res string:'baz' with:'1234').
+        Transcript showCr:'bar is translated to: ' , (res string:'bar').
+        Transcript showCr:'foo is translated to: ' , (res string:'foo').
+        Transcript showCr:'fooBar is translated to: ' , (res string:'fooBar').
+                                                                        [exEnd]
     set the Language to french:
-
-	Language := #french
-
+                                                                        [exBegin]
+        Language := #french
+                                                                        [exEnd]
     and repeat the above.
-
-	Language := #english 
-	Language := #german 
+    back to english:
+                                                                        [exBegin]
+        Language := #english 
+                                                                        [exEnd]
+    back to german:
+                                                                        [exBegin]
+        Language := #german 
+                                                                        [exEnd]
 "
 ! !
 
@@ -551,6 +556,6 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/RsrcPack.st,v 1.28 1996-04-25 16:33:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/RsrcPack.st,v 1.29 1996-04-27 17:56:19 cg Exp $'
 ! !
 ResourcePack initialize!