--- a/FileSelectionBox.st Sat Apr 27 20:13:37 1996 +0200
+++ b/FileSelectionBox.st Sat Apr 27 20:21:37 1996 +0200
@@ -67,7 +67,8 @@
[see also:]
DialogBox
EnterBox2 YesNoBox
- ListSelectionBox FileSaveBox
+ ListSelectionBox FileSaveBox
+ FileSelectionList SelectionInListView
"
!
@@ -76,31 +77,37 @@
simple standard queries
very simple:
+ [exBegin]
|name|
- name := FileSelectionBox requestFilename.
+ name := FileSelectionBox requestFileName.
Transcript showCr:name
+ [exEnd]
simple:
+ [exBegin]
|name|
- name := FileSelectionBox requestFilename:'which file ?'.
+ name := FileSelectionBox requestFileName:'which file ?'.
Transcript showCr:name
+ [exEnd]
with initial selection:
+ [exBegin]
|name|
- name := FileSelectionBox requestFilename:'which file ?' default:'Make.proto'.
+ name := FileSelectionBox requestFileName:'which file ?' default:'Make.proto'.
Transcript showCr:name
+ [exEnd]
more detailed setup
setting title:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
@@ -108,25 +115,28 @@
box accepted ifTrue:[
Transcript showCr:'you selected: ' , box
]
+ [exEnd]
setting a matchpattern:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
box pattern:'*.rc'.
box open
+ [exEnd]
setting multiple patterns:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
box pattern:'*.rc;*.st'.
box open
+ [exEnd]
setting a matchblock:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
@@ -134,9 +144,10 @@
box pattern:'*'.
box matchBlock:[:name | name asFilename baseName first between:$a and:$z].
box open
+ [exEnd]
both pattern and matchBlock:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which directory ?'.
@@ -145,36 +156,40 @@
box matchBlock:[:name | OperatingSystem isDirectory:name].
box action:[:fn | Transcript showCr:fn].
box open
+ [exEnd]
dont show the parent directory:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which directory ?'.
box listView ignoreParentDirectory:true.
box open
+ [exEnd]
dont show any directory:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
box listView ignoreDirectories:true.
box open
+ [exEnd]
dont show any directory or hidden file:
(notice the basename extraction - we are not interrested in the full pathName)
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
box listView ignoreDirectories:true.
box matchBlock:[:name | (name asFilename baseName startsWith:'.') not].
box open
+ [exEnd]
dont allow direct filename entry:
(i.e. avoid the user choosing files from other directories)
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which one ?'.
@@ -183,10 +198,11 @@
box accepted ifTrue:[
Transcript showCr:'path is ' , box pathName
].
+ [exEnd]
combined with above directory ignoring,
this limits selection of files from a single directory:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which file ?'.
@@ -196,9 +212,10 @@
box accepted ifTrue:[
Transcript showCr:'path is ' , box pathName
].
+ [exEnd]
finally, an action:
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which directory ?'.
@@ -206,12 +223,13 @@
box matchBlock:[:name | OperatingSystem isDirectory:name].
box action:[:name | Transcript showCr:name].
box open
+ [exEnd]
concrete examples:
only show files beginning with lowercase characters
and ending in '.c':
-
+ [exBegin]
|box|
box := FileSelectionBox new.
box title:'Which directory ?'.
@@ -226,6 +244,7 @@
Transcript showCr:'files name: ' , box fileName.
Transcript showCr:'directory : ' , box directory.
]
+ [exEnd]
"
! !
@@ -578,5 +597,5 @@
!FileSelectionBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.31 1996-04-25 17:19:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.32 1996-04-27 18:15:18 cg Exp $'
! !