author | Claus Gittinger <cg@exept.de> |
Tue, 17 Jan 2006 13:17:10 +0100 | |
changeset 3237 | 4c6fe0664cab |
parent 2745 | fcf82800288c |
child 3468 | 72b521780218 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
||
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
13 |
"{ Package: 'stx:libwidg' }" |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
14 |
|
0 | 15 |
ListSelectionBox subclass:#FileSelectionBox |
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
16 |
instanceVariableNames:'patternField selectingDirectory allowMakeDirectory' |
1320 | 17 |
classVariableNames:'LastFileSelectionDirectory' |
351 | 18 |
poolDictionaries:'' |
19 |
category:'Views-DialogBoxes' |
|
0 | 20 |
! |
21 |
||
849 | 22 |
!FileSelectionBox class methodsFor:'documentation'! |
7 | 23 |
|
38 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
59 | 27 |
All Rights Reserved |
38 | 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 |
||
7 | 38 |
documentation |
39 |
" |
|
38 | 40 |
this class implements file selection boxes. Instances show a list of |
41 |
files, and perform an action block with the selected pathname as |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
42 |
argument when ok is clicked. It is also possible, to open the box |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
43 |
without action and ask it afterward if it has been left with ok |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
44 |
(i.e. the ST-80 way, asking 'aBox accepted ifTrue:[...]') |
38 | 45 |
|
46 |
There is an optional PatternField, which shows itself when a pattern |
|
47 |
is defined (i.e. if there is no pattern, it is hidden). |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
48 |
If there is a pattern, only files matching the pattern are shown in |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
49 |
the list. Directories are not affected by the patternField. |
38 | 50 |
|
51 |
In addition, there is an optional matchBlock (actually this is defined |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
52 |
in the FileSelectionList). Only names for which this matchblock |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
53 |
returns true will be presented. The matchBlock affects both regular files |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
54 |
and names of directories. The argument passed to the matchBlock is the full |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
55 |
pathname. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
56 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
57 |
All of the actual work is done in the fileList; see the documentation |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
58 |
of FileSelectionList for more options |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
59 |
(you can access a boxes fileList via 'aBox>>listView' and get access to all |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
60 |
of those fancy settings) |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
61 |
For example, by accessing the list, it is possible to hide all directories |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
62 |
('aBox listView ignoreDirectories:true'), to hide the parentDirectory alone |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
63 |
('aBox listView ignoreParentDirectory') and to turn off the marking |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
64 |
of subdirectories ('aBox listView markSubdirectories:false'). |
585 | 65 |
|
66 |
[author:] |
|
67 |
Claus Gittinger |
|
68 |
||
69 |
[see also:] |
|
70 |
DialogBox |
|
648 | 71 |
EnterBox2 FilenameEnterBox YesNoBox |
593 | 72 |
ListSelectionBox FileSaveBox |
73 |
FileSelectionList SelectionInListView |
|
62 | 74 |
" |
75 |
! |
|
38 | 76 |
|
62 | 77 |
examples |
78 |
" |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
79 |
simple standard queries |
2441 | 80 |
(notice, that the receiver of those messages is Dialog - this should always |
81 |
be done for compatibility - although the real fileBox implementation is here). |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
82 |
|
238 | 83 |
very simple: |
593 | 84 |
[exBegin] |
351 | 85 |
|name| |
238 | 86 |
|
2441 | 87 |
name := Dialog requestFileName. |
655 | 88 |
Transcript showCR:name |
593 | 89 |
[exEnd] |
38 | 90 |
|
238 | 91 |
|
92 |
simple: |
|
593 | 93 |
[exBegin] |
351 | 94 |
|name| |
238 | 95 |
|
593 | 96 |
name := FileSelectionBox requestFileName:'which file ?'. |
655 | 97 |
Transcript showCR:name |
593 | 98 |
[exEnd] |
38 | 99 |
|
238 | 100 |
|
101 |
with initial selection: |
|
593 | 102 |
[exBegin] |
351 | 103 |
|name| |
238 | 104 |
|
593 | 105 |
name := FileSelectionBox requestFileName:'which file ?' default:'Make.proto'. |
655 | 106 |
Transcript showCR:name |
593 | 107 |
[exEnd] |
38 | 108 |
|
238 | 109 |
|
12 | 110 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
111 |
more detailed setup |
238 | 112 |
|
113 |
setting title: |
|
593 | 114 |
[exBegin] |
351 | 115 |
|box| |
116 |
box := FileSelectionBox new. |
|
117 |
box title:'Which file ?'. |
|
118 |
box open. |
|
119 |
box accepted ifTrue:[ |
|
1411 | 120 |
Transcript showCR:'you selected: ' , box pathName |
351 | 121 |
] |
593 | 122 |
[exEnd] |
38 | 123 |
|
238 | 124 |
setting a matchpattern: |
593 | 125 |
[exBegin] |
351 | 126 |
|box| |
127 |
box := FileSelectionBox new. |
|
128 |
box title:'Which file ?'. |
|
129 |
box pattern:'*.rc'. |
|
130 |
box open |
|
593 | 131 |
[exEnd] |
351 | 132 |
|
133 |
setting multiple patterns: |
|
593 | 134 |
[exBegin] |
351 | 135 |
|box| |
136 |
box := FileSelectionBox new. |
|
137 |
box title:'Which file ?'. |
|
138 |
box pattern:'*.rc;*.st'. |
|
139 |
box open |
|
593 | 140 |
[exEnd] |
38 | 141 |
|
238 | 142 |
setting a matchblock: |
593 | 143 |
[exBegin] |
351 | 144 |
|box| |
145 |
box := FileSelectionBox new. |
|
146 |
box title:'Which file ?'. |
|
147 |
box directory:'/etc'. |
|
148 |
box pattern:'*'. |
|
149 |
box matchBlock:[:name | name asFilename baseName first between:$a and:$z]. |
|
150 |
box open |
|
593 | 151 |
[exEnd] |
44 | 152 |
|
238 | 153 |
both pattern and matchBlock: |
593 | 154 |
[exBegin] |
351 | 155 |
|box| |
156 |
box := FileSelectionBox new. |
|
157 |
box title:'Which directory ?'. |
|
158 |
box selectingDirectory:true. |
|
159 |
box pattern:'l*'. |
|
160 |
box matchBlock:[:name | OperatingSystem isDirectory:name]. |
|
655 | 161 |
box action:[:fn | Transcript showCR:fn]. |
351 | 162 |
box open |
593 | 163 |
[exEnd] |
238 | 164 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
165 |
dont show the parent directory: |
593 | 166 |
[exBegin] |
351 | 167 |
|box| |
168 |
box := FileSelectionBox new. |
|
169 |
box title:'Which directory ?'. |
|
170 |
box listView ignoreParentDirectory:true. |
|
171 |
box open |
|
593 | 172 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
173 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
174 |
dont show any directory: |
593 | 175 |
[exBegin] |
351 | 176 |
|box| |
177 |
box := FileSelectionBox new. |
|
178 |
box title:'Which file ?'. |
|
179 |
box listView ignoreDirectories:true. |
|
180 |
box open |
|
593 | 181 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
182 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
183 |
dont show any directory or hidden file: |
842
a27a1c6ddde0
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
800
diff
changeset
|
184 |
(notice the basename extraction - we are not interested in the full pathName) |
593 | 185 |
[exBegin] |
351 | 186 |
|box| |
187 |
box := FileSelectionBox new. |
|
188 |
box title:'Which file ?'. |
|
189 |
box listView ignoreDirectories:true. |
|
190 |
box matchBlock:[:name | (name asFilename baseName startsWith:'.') not]. |
|
191 |
box open |
|
593 | 192 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
193 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
194 |
dont allow direct filename entry: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
195 |
(i.e. avoid the user choosing files from other directories) |
593 | 196 |
[exBegin] |
351 | 197 |
|box| |
198 |
box := FileSelectionBox new. |
|
199 |
box title:'Which one ?'. |
|
200 |
box enterField beInvisible. |
|
201 |
box open. |
|
202 |
box accepted ifTrue:[ |
|
655 | 203 |
Transcript showCR:'path is ' , box pathName |
351 | 204 |
]. |
593 | 205 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
206 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
207 |
combined with above directory ignoring, |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
208 |
this limits selection of files from a single directory: |
593 | 209 |
[exBegin] |
351 | 210 |
|box| |
211 |
box := FileSelectionBox new. |
|
212 |
box title:'Which file ?'. |
|
213 |
box enterField beInvisible. |
|
214 |
box listView ignoreDirectories:true. |
|
215 |
box open. |
|
216 |
box accepted ifTrue:[ |
|
655 | 217 |
Transcript showCR:'path is ' , box pathName |
351 | 218 |
]. |
593 | 219 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
220 |
|
238 | 221 |
finally, an action: |
593 | 222 |
[exBegin] |
351 | 223 |
|box| |
224 |
box := FileSelectionBox new. |
|
225 |
box title:'Which directory ?'. |
|
226 |
box pattern:'l*'. |
|
227 |
box matchBlock:[:name | OperatingSystem isDirectory:name]. |
|
655 | 228 |
box action:[:name | Transcript showCR:name]. |
351 | 229 |
box open |
593 | 230 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
231 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
232 |
concrete examples: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
233 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
234 |
only show files beginning with lowercase characters |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
235 |
and ending in '.c': |
593 | 236 |
[exBegin] |
351 | 237 |
|box| |
238 |
box := FileSelectionBox new. |
|
239 |
box title:'Which directory ?'. |
|
240 |
box matchBlock:[:name | |
|
241 |
box pathName asFilename isDirectory |
|
242 |
or:[name first isLowercase |
|
243 |
and:[name endsWith:'.c']] |
|
244 |
]. |
|
245 |
box open. |
|
246 |
box accepted ifTrue:[ |
|
655 | 247 |
Transcript showCR:'full path: ' , box pathName. |
248 |
Transcript showCR:'files name: ' , box fileName. |
|
1643
2710f3be2a77
fixed #fileName - return fileName only (not full path)
Claus Gittinger <cg@exept.de>
parents:
1639
diff
changeset
|
249 |
Transcript showCR:'directory : ' , box directory pathName. |
351 | 250 |
] |
593 | 251 |
[exEnd] |
7 | 252 |
" |
253 |
! ! |
|
0 | 254 |
|
1320 | 255 |
!FileSelectionBox class methodsFor:'accessing'! |
256 |
||
257 |
lastFileSelectionDirectory |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
258 |
"return the name of the directory used in the previous |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
259 |
fileSelection dialog. This will be used as default for the next dialog, |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
260 |
if no explicit path is specified (see requestFileName:* methods)" |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
261 |
|
1574 | 262 |
|f| |
263 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
264 |
LastFileSelectionDirectory notNil ifTrue:[ |
1574 | 265 |
((f := LastFileSelectionDirectory asFilename) exists |
266 |
and:[f isDirectory]) ifFalse:[ |
|
267 |
LastFileSelectionDirectory := nil. |
|
268 |
] |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
269 |
]. |
1320 | 270 |
^ LastFileSelectionDirectory |
271 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
272 |
"Created: / 9.9.1997 / 10:03:17 / cg" |
1574 | 273 |
"Modified: / 16.6.1998 / 15:11:20 / cg" |
1320 | 274 |
! |
275 |
||
276 |
lastFileSelectionDirectory:aDirectoryString |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
277 |
"set the name of the directory used in the previous |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
278 |
fileSelection dialog. This will be used as default for the next dialog, |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
279 |
if no explicit path is specified (see requestFileName:* methods)" |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
280 |
|
1320 | 281 |
LastFileSelectionDirectory := aDirectoryString |
282 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
283 |
"Created: / 9.9.1997 / 10:03:42 / cg" |
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
284 |
"Modified: / 15.6.1998 / 14:05:21 / cg" |
1320 | 285 |
! ! |
286 |
||
849 | 287 |
!FileSelectionBox class methodsFor:'defaults'! |
12 | 288 |
|
289 |
listViewType |
|
290 |
"return the type of listView - using a FileSelectionList here" |
|
291 |
||
292 |
^ FileSelectionList |
|
293 |
! ! |
|
294 |
||
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
295 |
!FileSelectionBox class methodsFor:'menu specs'! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
296 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
297 |
fileListMenu |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
298 |
"This resource specification was automatically generated |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
299 |
by the MenuEditor of ST/X." |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
300 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
301 |
"Do not manually edit this!! If it is corrupted, |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
302 |
the MenuEditor may not be able to read the specification." |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
303 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
304 |
" |
2354 | 305 |
MenuEditor new openOnClass:FileSelectionBox andSelector:#fileListMenu |
306 |
(Menu new fromLiteralArrayEncoding:(FileSelectionBox fileListMenu)) startUp |
|
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
307 |
" |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
308 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
309 |
<resource: #menu> |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
310 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
311 |
^ |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
312 |
#(#Menu |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
313 |
#( |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
314 |
#(#MenuItem |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
315 |
#label: 'New Folder...' |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
316 |
#translateLabel: true |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
317 |
#value: #fileListMenuNewFolder |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
318 |
) |
2354 | 319 |
#(#MenuItem |
320 |
#label: '-' |
|
321 |
) |
|
322 |
#(#MenuItem |
|
323 |
#label: 'Remove...' |
|
324 |
#translateLabel: true |
|
325 |
#value: #fileListMenuRemove |
|
326 |
) |
|
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
327 |
) |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
328 |
nil |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
329 |
nil |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
330 |
) |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
331 |
! ! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
332 |
|
197 | 333 |
!FileSelectionBox methodsFor:'accessing'! |
3 | 334 |
|
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
335 |
allowMakeDirectory:aBoolean |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
336 |
"allow or deny creation of new directories; |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
337 |
The default is to allow it." |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
338 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
339 |
allowMakeDirectory := aBoolean. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
340 |
! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
341 |
|
197 | 342 |
contents |
343 |
"return the current entered value (i.e. the enterFields string). |
|
344 |
redefined to return the full pathname." |
|
345 |
||
1809 | 346 |
|string| |
3 | 347 |
|
197 | 348 |
string := super contents. |
2638
4dac570cd467
fixed cancel-value if in requestFileName mode
Claus Gittinger <cg@exept.de>
parents:
2463
diff
changeset
|
349 |
string size == 0 ifTrue:[ |
4dac570cd467
fixed cancel-value if in requestFileName mode
Claus Gittinger <cg@exept.de>
parents:
2463
diff
changeset
|
350 |
selectingDirectory ifFalse:[^ string]. |
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
351 |
^ selectionList directory pathName |
121 | 352 |
]. |
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
353 |
(string asFilename isAbsolute) ifTrue:[ |
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
354 |
^ string |
77 | 355 |
]. |
197 | 356 |
^ (selectionList directory pathName asFilename construct:string) asString |
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
357 |
|
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
358 |
"Modified: / 9.9.1998 / 21:23:16 / cg" |
132 | 359 |
! |
360 |
||
1672 | 361 |
directory |
362 |
"return the directory which is currently shown" |
|
363 |
||
364 |
^ selectionList directory |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
365 |
! |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
366 |
|
1672 | 367 |
directory:directoryName |
368 |
"change the directory shown in the list." |
|
369 |
||
2463 | 370 |
selectionList directory:directoryName. |
371 |
selectingDirectory ifTrue:[ |
|
372 |
enterField contents:directoryName asFilename pathName |
|
373 |
] |
|
132 | 374 |
! |
375 |
||
1672 | 376 |
fileName |
377 |
"if some filename has been entered, return it (without the directory path) |
|
378 |
otherwise, return nil" |
|
379 |
||
380 |
|string| |
|
381 |
||
382 |
string := super contents. |
|
383 |
string isNil ifTrue:[^ nil]. |
|
384 |
^ self pathName asFilename baseName |
|
385 |
||
386 |
"Modified: / 12.8.1998 / 09:54:01 / cg" |
|
351 | 387 |
! |
388 |
||
1672 | 389 |
matchBlock:aBlock |
390 |
"set the matchBlock (in the selectionList). Only files |
|
391 |
for which the block returns true are shown. |
|
392 |
The matching is actually done in the fileSelectionList." |
|
393 |
||
394 |
selectionList matchBlock:aBlock |
|
197 | 395 |
! |
0 | 396 |
|
1672 | 397 |
openOn:aPath |
398 |
"open the box showing files in aPath. |
|
399 |
This is only a shortcut message - no new functionality." |
|
400 |
||
401 |
self directory:aPath. |
|
402 |
self showAtPointer |
|
38 | 403 |
! |
404 |
||
351 | 405 |
pathName |
406 |
"same as contents - return the full pathname of the selected file, |
|
407 |
or the pathname of the directory if nothing has been entered" |
|
408 |
||
409 |
^ self contents |
|
410 |
! |
|
411 |
||
1672 | 412 |
pattern:aPattern |
413 |
"set the pattern - this also enables the PatternField |
|
414 |
(if the pattern is non-nil) or hides it (if nil)." |
|
415 |
||
416 |
|focusSequence| |
|
130 | 417 |
|
1672 | 418 |
patternField initialText:aPattern. |
419 |
selectionList pattern:aPattern. |
|
420 |
aPattern isNil ifTrue:[ |
|
421 |
patternField beInvisible. |
|
422 |
self makeUntabable:patternField. |
|
423 |
focusSequence := (Array |
|
424 |
with:enterField |
|
425 |
with:selectionList |
|
426 |
with:okButton |
|
427 |
with:abortButton) |
|
428 |
] ifFalse:[ |
|
429 |
patternField beVisible. |
|
430 |
self makeTabable:patternField before:enterField. |
|
431 |
focusSequence := (Array |
|
432 |
with:patternField |
|
433 |
with:enterField |
|
434 |
with:selectionList |
|
435 |
with:okButton |
|
436 |
with:abortButton) |
|
437 |
]. |
|
438 |
||
439 |
windowGroup notNil ifTrue:[ |
|
440 |
windowGroup focusSequence:focusSequence |
|
441 |
]. |
|
442 |
||
443 |
"Modified: 18.10.1997 / 03:02:05 / cg" |
|
351 | 444 |
! |
445 |
||
446 |
selectingDirectory:aBoolean |
|
849 | 447 |
"setup the box for directory selection (hides regular files). |
448 |
Use this, to ask the user for a directories name" |
|
449 |
||
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
450 |
selectingDirectory := aBoolean. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
451 |
aBoolean ifTrue:[ |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
452 |
selectionList directoryChangeAction:[:entry | self directoryChanged]. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
453 |
selectionList directorySelectAction:[:entry | self directorySelected]. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
454 |
selectionList ignoreFiles:true. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
455 |
] |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
456 |
|
849 | 457 |
"Modified: 22.10.1996 / 13:24:50 / cg" |
197 | 458 |
! ! |
459 |
||
460 |
!FileSelectionBox methodsFor:'change & update'! |
|
461 |
||
462 |
update:something with:argument from:changedObject |
|
463 |
|commonName index s| |
|
464 |
||
465 |
something == #directory ifTrue:[ |
|
466 |
" |
|
467 |
sent by fileNameEnterField, if a filename |
|
468 |
completion was not possible due to multiple |
|
469 |
matches. |
|
470 |
" |
|
471 |
selectionList directory:argument. |
|
472 |
s := enterField contents. |
|
473 |
s notNil ifTrue:[ |
|
474 |
commonName := s asFilename baseName. |
|
475 |
commonName size > 0 ifTrue:[ |
|
476 |
index := selectionList list findFirst:[:entry | entry startsWith:commonName]. |
|
477 |
index ~~ 0 ifTrue:[ |
|
478 |
selectionList makeLineVisible:index |
|
479 |
] |
|
480 |
] |
|
481 |
] |
|
482 |
] |
|
483 |
! ! |
|
484 |
||
485 |
!FileSelectionBox methodsFor:'initialization'! |
|
486 |
||
1672 | 487 |
createEnterField |
488 |
"if the (optional) class FilenameEditField is present, use |
|
489 |
it, since it provides filename completion. Otherwise, we have |
|
490 |
to live with the dumb (default) field ... |
|
491 |
" |
|
492 |
FilenameEditField notNil ifTrue:[ |
|
493 |
^ FilenameEditField new. |
|
494 |
]. |
|
495 |
^ super createEnterField |
|
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
496 |
|
1672 | 497 |
"Modified: 18.4.1996 / 20:02:24 / cg" |
38 | 498 |
! |
0 | 499 |
|
1672 | 500 |
initialize |
501 |
|corner| |
|
502 |
||
503 |
super initialize. |
|
504 |
selectingDirectory := false. |
|
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
505 |
allowMakeDirectory := true. |
1672 | 506 |
|
507 |
label := resources string:'File dialog'. |
|
508 |
||
509 |
labelField extent:(0.7 @ labelField height). |
|
510 |
labelField label:(resources string:'select a file:'). |
|
511 |
labelField adjust:#left. |
|
512 |
||
513 |
patternField := EditField in:self. |
|
514 |
self is3D ifTrue:[ |
|
515 |
corner := (1.0 @ (labelField origin y+patternField heightIncludingBorder)). |
|
516 |
] ifFalse:[ |
|
517 |
corner := [(width - ViewSpacing - (patternField borderWidth * 2)) @ (labelField origin y+patternField height"IncludingBorder")]. |
|
518 |
]. |
|
519 |
patternField origin:(0.7 @ labelField origin y) corner:corner. |
|
520 |
patternField rightInset:ViewSpacing. |
|
521 |
patternField initialText:'*'. |
|
522 |
patternField leaveAction:[:reason | self patternChanged]. |
|
523 |
patternField crAction:[self patternChanged]. |
|
524 |
patternField hiddenOnRealize:true. "delay showing, until a pattern is defined" |
|
525 |
"/ no, since its invisible |
|
526 |
"/ self makeTabable:patternField before:enterField. |
|
527 |
||
528 |
enterField addDependent:self. |
|
529 |
||
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
530 |
selectionList menuHolder:self; menuMessage:#fileListMenu; menuPerformer:self. |
2375
1e3b7281d4ac
added optional ignoreCase in matchpattern
Claus Gittinger <cg@exept.de>
parents:
2354
diff
changeset
|
531 |
selectionList ignoreCaseInPattern:true. |
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
532 |
|
1672 | 533 |
" |
534 |
FileSelectionBox open |
|
535 |
FileSelectionBox new show |
|
536 |
" |
|
537 |
||
538 |
"Modified: 18.10.1997 / 02:47:49 / cg" |
|
539 |
! |
|
540 |
||
541 |
postRealize |
|
542 |
"if some default is present in the enterField, |
|
543 |
scroll to make this one visible" |
|
544 |
||
545 |
|contents| |
|
546 |
||
547 |
super postRealize. |
|
548 |
(contents := enterField contents) notNil ifTrue:[ |
|
549 |
contents notEmpty ifTrue:[ |
|
550 |
selectionList makeVisible:contents |
|
551 |
] |
|
552 |
] |
|
553 |
||
554 |
"Created: 24.7.1997 / 18:19:14 / cg" |
|
197 | 555 |
! ! |
556 |
||
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
557 |
!FileSelectionBox methodsFor:'menu'! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
558 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
559 |
fileListMenu |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
560 |
allowMakeDirectory ifFalse:[^ self]. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
561 |
^ self class fileListMenu |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
562 |
! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
563 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
564 |
fileListMenuNewFolder |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
565 |
|newDirName d| |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
566 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
567 |
newDirName := Dialog request:'Name of new Folder:'. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
568 |
newDirName size == 0 ifTrue:[^ self]. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
569 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
570 |
d := self directory asFilename construct:newDirName. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
571 |
d exists ifTrue:[ |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
572 |
d isDirectory ifTrue:[ |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
573 |
^ self |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
574 |
]. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
575 |
self warn:(resources string:'A file named %1 already exists.' with:newDirName). |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
576 |
^ self |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
577 |
]. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
578 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
579 |
d makeDirectory. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
580 |
self updateList. |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
581 |
|
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
582 |
" |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
583 |
self open |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
584 |
" |
2354 | 585 |
! |
586 |
||
587 |
fileListMenuRemove |
|
588 |
|selectedFilename baseName| |
|
589 |
||
590 |
selectedFilename := self pathName asFilename. |
|
591 |
baseName := selectedFilename baseName. |
|
592 |
||
593 |
(Dialog confirm:(resources string:'Really remove ''%1'' ?' with:baseName allBold)) ifFalse:[ |
|
594 |
^ self. |
|
595 |
]. |
|
596 |
||
597 |
selectedFilename isDirectory ifTrue:[ |
|
598 |
self warn:(resources string:'%1 is a directory..' with:baseName). |
|
599 |
^ self. |
|
600 |
]. |
|
601 |
||
602 |
selectedFilename delete. |
|
2376 | 603 |
self updateListWithoutScrolling. |
2231
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
604 |
! ! |
48ab82d819bc
added makeDirectory popUpMenu.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
605 |
|
197 | 606 |
!FileSelectionBox methodsFor:'private'! |
607 |
||
1672 | 608 |
updateList |
609 |
selectionList updateList |
|
2376 | 610 |
! |
611 |
||
612 |
updateListWithoutScrolling |
|
613 |
selectionList updateListWithoutScrolling |
|
1672 | 614 |
! ! |
38 | 615 |
|
197 | 616 |
!FileSelectionBox methodsFor:'queries'! |
617 |
||
1672 | 618 |
preferredExtent |
619 |
"return my preferred extent - thats the minimum size |
|
620 |
to make everything visible" |
|
621 |
||
622 |
|wWanted hWanted mm| |
|
623 |
||
624 |
"/ If I have an explicit preferredExtent .. |
|
625 |
||
626 |
preferredExtent notNil ifTrue:[ |
|
627 |
^ preferredExtent |
|
628 |
]. |
|
629 |
||
630 |
mm := ViewSpacing. |
|
631 |
||
632 |
wWanted := mm + |
|
633 |
labelField preferredExtent x + |
|
634 |
(mm * 2) + |
|
635 |
patternField preferredExtent x + |
|
636 |
mm. |
|
637 |
(wWanted < width) ifTrue:[ |
|
638 |
wWanted := width |
|
639 |
]. |
|
640 |
hWanted := mm + labelField height + |
|
641 |
mm + enterField height + |
|
642 |
mm + selectionList height + |
|
643 |
mm + buttonPanel preferredExtent y + |
|
644 |
mm. |
|
645 |
||
646 |
(hWanted < height) ifTrue:[ |
|
647 |
hWanted := height |
|
648 |
]. |
|
649 |
^ (wWanted @ hWanted) |
|
650 |
||
651 |
"Modified: 19.7.1996 / 20:44:04 / cg" |
|
652 |
! ! |
|
197 | 653 |
|
654 |
!FileSelectionBox methodsFor:'user actions'! |
|
655 |
||
1672 | 656 |
directoryChanged |
657 |
selectingDirectory ifTrue:[ |
|
658 |
selectionList changeDirectory. |
|
659 |
enterField contents:(selectionList directory pathName). |
|
660 |
selectionList setSelection:nil. |
|
661 |
]. |
|
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
662 |
|
1672 | 663 |
"Created: 18.4.1996 / 18:38:21 / cg" |
664 |
"Modified: 25.5.1996 / 12:27:05 / cg" |
|
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
665 |
! |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
666 |
|
1672 | 667 |
directorySelected |
668 |
"a directory was selected - show the new path in the inputField, |
|
669 |
if we are in directory mode" |
|
670 |
||
671 |
selectingDirectory ifTrue:[ |
|
672 |
|newDir| |
|
673 |
||
674 |
newDir := (selectionList directory) |
|
675 |
construct:selectionList selectionValue. |
|
676 |
enterField contents:newDir pathName. |
|
677 |
]. |
|
678 |
||
679 |
"Created: / 18.4.1996 / 18:46:15 / cg" |
|
680 |
"Modified: / 7.8.1998 / 17:19:26 / cg" |
|
681 |
! |
|
682 |
||
683 |
doubleClick |
|
684 |
|entry| |
|
685 |
||
686 |
entry := selectionList selectionValue. |
|
687 |
entry notNil ifTrue:[ |
|
688 |
((selectionList directory asFilename construct:entry) isDirectory) ifFalse:[ |
|
689 |
selectingDirectory ifFalse:[ |
|
690 |
enterField contents:entry. |
|
691 |
self okPressed |
|
692 |
] |
|
693 |
] |
|
694 |
]. |
|
695 |
||
696 |
"Modified: 19.10.1997 / 00:17:37 / cg" |
|
197 | 697 |
! |
698 |
||
699 |
okPressed |
|
700 |
"called for both on ok-press and on return-key" |
|
701 |
||
702 |
|dir string fname| |
|
703 |
||
704 |
string := enterField contents. |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
705 |
(string notEmptyOrNil) ifTrue:[ |
351 | 706 |
string := string withoutSeparators. |
707 |
string asFilename isAbsolute ifTrue:[ |
|
708 |
fname := string asFilename |
|
709 |
] ifFalse:[ |
|
710 |
dir := selectionList directory pathName asFilename. |
|
711 |
fname := dir construct:string |
|
712 |
]. |
|
713 |
fname isDirectory ifTrue:[ |
|
714 |
selectingDirectory ifFalse:[ |
|
715 |
selectionList directory:fname asString. |
|
716 |
self updateList. |
|
717 |
^ self |
|
718 |
] |
|
719 |
] |
|
720 |
] ifFalse:[ |
|
721 |
selectingDirectory ifTrue:[ |
|
722 |
enterField contents:(selectionList directory pathName). |
|
723 |
]. |
|
38 | 724 |
]. |
351 | 725 |
|
197 | 726 |
super okPressed |
351 | 727 |
|
1674
75149fa16b10
oops - leftover halt removed.
Claus Gittinger <cg@exept.de>
parents:
1672
diff
changeset
|
728 |
"Modified: / 10.9.1998 / 22:19:11 / cg" |
197 | 729 |
! |
730 |
||
1672 | 731 |
patternChanged |
732 |
selectionList pattern:patternField contents. |
|
746
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
733 |
self updateList |
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
734 |
|
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
735 |
"Created: 4.6.1996 / 20:30:23 / cg" |
1672 | 736 |
! |
737 |
||
738 |
selectionChanged |
|
739 |
|entry| |
|
740 |
||
741 |
entry := selectionList selectionValue. |
|
742 |
(selectionList directory asFilename construct:entry) type == #directory ifFalse:[ |
|
743 |
selectingDirectory ifTrue:[ |
|
744 |
enterField contents:(selectionList directory pathName). |
|
745 |
selectionList setSelection:nil. |
|
746 |
^ self |
|
747 |
] |
|
748 |
]. |
|
749 |
enterField contents:entry |
|
750 |
||
751 |
"Modified: 21.9.1997 / 12:07:55 / cg" |
|
0 | 752 |
! ! |
197 | 753 |
|
849 | 754 |
!FileSelectionBox class methodsFor:'documentation'! |
240 | 755 |
|
756 |
version |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
757 |
^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.65 2006-01-17 12:16:46 cg Exp $' |
240 | 758 |
! ! |