examples
authorClaus Gittinger <cg@exept.de>
Tue, 05 Dec 1995 20:12:25 +0100
changeset 238 a81e517187e4
parent 237 5c828a70dffd
child 239 73d0fb68b2bf
examples
FSelBox.st
FileSelectionBox.st
--- a/FSelBox.st	Tue Dec 05 19:37:43 1995 +0100
+++ b/FSelBox.st	Tue Dec 05 20:12:25 1995 +0100
@@ -52,30 +52,47 @@
 
 examples 
 "
-    Example1:
+    very simple:
+	|name|
+
+	name := FileSelectionBox requestFilename.
+	Transcript showCr:name
 
-	FileSelectionBox open
+
+    simple:
+	|name|
+
+	name := FileSelectionBox requestFilename:'which file ?'.
+	Transcript showCr:name
 
-    Example2:
+
+    with initial selection:
+	|name|
+
+	name := FileSelectionBox requestFilename:'which file ?' default:'Make.proto'.
+	Transcript showCr:name
 
-	FileSelectionBox new open
+
+    more detailed setup:
 
-    Example3:
+	FileSelectionBox new openModal
+
+    setting title:
 
 	|box|
 	box := FileSelectionBox new.
 	box title:'Which file ?'.
 	box open
 
-    Example4:
+    setting a matchpattern:
 
 	|box|
 	box := FileSelectionBox new.
 	box title:'Which file ?'.
-	box pattern:'*.doc'.
+	box pattern:'*.rc'.
 	box open
 
-    Example5:
+    setting a matchblock:
 
 	|box|
 	box := FileSelectionBox new.
@@ -84,7 +101,7 @@
 	box matchBlock:[:name | name first isLowercase].
 	box open
 
-    Example6:
+    both pattern and matchBlock:
 
 	|box|
 	box := FileSelectionBox new.
@@ -92,11 +109,21 @@
 	box pattern:'l*'.
 	box matchBlock:[:name | OperatingSystem isDirectory:name].
 	box open
+
+    finally, an action:
+
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which directory ?'.
+	box pattern:'l*'.
+	box matchBlock:[:name | OperatingSystem isDirectory:name].
+	box action:[:name | Transcript showCr:name].
+	box open
 "
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.24 1995-12-05 12:23:53 chrisy Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.25 1995-12-05 19:12:25 cg Exp $'
 ! !
 
 !FileSelectionBox class methodsFor:'defaults'!
--- a/FileSelectionBox.st	Tue Dec 05 19:37:43 1995 +0100
+++ b/FileSelectionBox.st	Tue Dec 05 20:12:25 1995 +0100
@@ -52,30 +52,47 @@
 
 examples 
 "
-    Example1:
+    very simple:
+	|name|
+
+	name := FileSelectionBox requestFilename.
+	Transcript showCr:name
 
-	FileSelectionBox open
+
+    simple:
+	|name|
+
+	name := FileSelectionBox requestFilename:'which file ?'.
+	Transcript showCr:name
 
-    Example2:
+
+    with initial selection:
+	|name|
+
+	name := FileSelectionBox requestFilename:'which file ?' default:'Make.proto'.
+	Transcript showCr:name
 
-	FileSelectionBox new open
+
+    more detailed setup:
 
-    Example3:
+	FileSelectionBox new openModal
+
+    setting title:
 
 	|box|
 	box := FileSelectionBox new.
 	box title:'Which file ?'.
 	box open
 
-    Example4:
+    setting a matchpattern:
 
 	|box|
 	box := FileSelectionBox new.
 	box title:'Which file ?'.
-	box pattern:'*.doc'.
+	box pattern:'*.rc'.
 	box open
 
-    Example5:
+    setting a matchblock:
 
 	|box|
 	box := FileSelectionBox new.
@@ -84,7 +101,7 @@
 	box matchBlock:[:name | name first isLowercase].
 	box open
 
-    Example6:
+    both pattern and matchBlock:
 
 	|box|
 	box := FileSelectionBox new.
@@ -92,11 +109,21 @@
 	box pattern:'l*'.
 	box matchBlock:[:name | OperatingSystem isDirectory:name].
 	box open
+
+    finally, an action:
+
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which directory ?'.
+	box pattern:'l*'.
+	box matchBlock:[:name | OperatingSystem isDirectory:name].
+	box action:[:name | Transcript showCr:name].
+	box open
 "
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.24 1995-12-05 12:23:53 chrisy Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.25 1995-12-05 19:12:25 cg Exp $'
 ! !
 
 !FileSelectionBox class methodsFor:'defaults'!