author | Claus Gittinger <cg@exept.de> |
Wed, 09 Sep 1998 22:27:16 +0200 | |
changeset 1671 | 5afdf222b738 |
parent 1670 | 8d24855a9f0b |
child 1672 | 4ad88fcbc3ac |
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 |
||
13 |
ListSelectionBox subclass:#FileSelectionBox |
|
351 | 14 |
instanceVariableNames:'patternField selectingDirectory' |
1320 | 15 |
classVariableNames:'LastFileSelectionDirectory' |
351 | 16 |
poolDictionaries:'' |
17 |
category:'Views-DialogBoxes' |
|
0 | 18 |
! |
19 |
||
849 | 20 |
!FileSelectionBox class methodsFor:'documentation'! |
7 | 21 |
|
38 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
59 | 25 |
All Rights Reserved |
38 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
7 | 36 |
documentation |
37 |
" |
|
38 | 38 |
this class implements file selection boxes. Instances show a list of |
39 |
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
|
40 |
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
|
41 |
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
|
42 |
(i.e. the ST-80 way, asking 'aBox accepted ifTrue:[...]') |
38 | 43 |
|
44 |
There is an optional PatternField, which shows itself when a pattern |
|
45 |
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
|
46 |
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
|
47 |
the list. Directories are not affected by the patternField. |
38 | 48 |
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
pathname. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
54 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
55 |
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
|
56 |
of FileSelectionList for more options |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
57 |
(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
|
58 |
of those fancy settings) |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
59 |
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
|
60 |
('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
|
61 |
('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
|
62 |
of subdirectories ('aBox listView markSubdirectories:false'). |
585 | 63 |
|
64 |
[author:] |
|
65 |
Claus Gittinger |
|
66 |
||
67 |
[see also:] |
|
68 |
DialogBox |
|
648 | 69 |
EnterBox2 FilenameEnterBox YesNoBox |
593 | 70 |
ListSelectionBox FileSaveBox |
71 |
FileSelectionList SelectionInListView |
|
62 | 72 |
" |
73 |
! |
|
38 | 74 |
|
62 | 75 |
examples |
76 |
" |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
77 |
simple standard queries |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
78 |
|
238 | 79 |
very simple: |
593 | 80 |
[exBegin] |
351 | 81 |
|name| |
238 | 82 |
|
593 | 83 |
name := FileSelectionBox requestFileName. |
655 | 84 |
Transcript showCR:name |
593 | 85 |
[exEnd] |
38 | 86 |
|
238 | 87 |
|
88 |
simple: |
|
593 | 89 |
[exBegin] |
351 | 90 |
|name| |
238 | 91 |
|
593 | 92 |
name := FileSelectionBox requestFileName:'which file ?'. |
655 | 93 |
Transcript showCR:name |
593 | 94 |
[exEnd] |
38 | 95 |
|
238 | 96 |
|
97 |
with initial selection: |
|
593 | 98 |
[exBegin] |
351 | 99 |
|name| |
238 | 100 |
|
593 | 101 |
name := FileSelectionBox requestFileName:'which file ?' default:'Make.proto'. |
655 | 102 |
Transcript showCR:name |
593 | 103 |
[exEnd] |
38 | 104 |
|
238 | 105 |
|
12 | 106 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
107 |
more detailed setup |
238 | 108 |
|
109 |
setting title: |
|
593 | 110 |
[exBegin] |
351 | 111 |
|box| |
112 |
box := FileSelectionBox new. |
|
113 |
box title:'Which file ?'. |
|
114 |
box open. |
|
115 |
box accepted ifTrue:[ |
|
1411 | 116 |
Transcript showCR:'you selected: ' , box pathName |
351 | 117 |
] |
593 | 118 |
[exEnd] |
38 | 119 |
|
238 | 120 |
setting a matchpattern: |
593 | 121 |
[exBegin] |
351 | 122 |
|box| |
123 |
box := FileSelectionBox new. |
|
124 |
box title:'Which file ?'. |
|
125 |
box pattern:'*.rc'. |
|
126 |
box open |
|
593 | 127 |
[exEnd] |
351 | 128 |
|
129 |
setting multiple patterns: |
|
593 | 130 |
[exBegin] |
351 | 131 |
|box| |
132 |
box := FileSelectionBox new. |
|
133 |
box title:'Which file ?'. |
|
134 |
box pattern:'*.rc;*.st'. |
|
135 |
box open |
|
593 | 136 |
[exEnd] |
38 | 137 |
|
238 | 138 |
setting a matchblock: |
593 | 139 |
[exBegin] |
351 | 140 |
|box| |
141 |
box := FileSelectionBox new. |
|
142 |
box title:'Which file ?'. |
|
143 |
box directory:'/etc'. |
|
144 |
box pattern:'*'. |
|
145 |
box matchBlock:[:name | name asFilename baseName first between:$a and:$z]. |
|
146 |
box open |
|
593 | 147 |
[exEnd] |
44 | 148 |
|
238 | 149 |
both pattern and matchBlock: |
593 | 150 |
[exBegin] |
351 | 151 |
|box| |
152 |
box := FileSelectionBox new. |
|
153 |
box title:'Which directory ?'. |
|
154 |
box selectingDirectory:true. |
|
155 |
box pattern:'l*'. |
|
156 |
box matchBlock:[:name | OperatingSystem isDirectory:name]. |
|
655 | 157 |
box action:[:fn | Transcript showCR:fn]. |
351 | 158 |
box open |
593 | 159 |
[exEnd] |
238 | 160 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
161 |
dont show the parent directory: |
593 | 162 |
[exBegin] |
351 | 163 |
|box| |
164 |
box := FileSelectionBox new. |
|
165 |
box title:'Which directory ?'. |
|
166 |
box listView ignoreParentDirectory:true. |
|
167 |
box open |
|
593 | 168 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
169 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
170 |
dont show any directory: |
593 | 171 |
[exBegin] |
351 | 172 |
|box| |
173 |
box := FileSelectionBox new. |
|
174 |
box title:'Which file ?'. |
|
175 |
box listView ignoreDirectories:true. |
|
176 |
box open |
|
593 | 177 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
178 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
179 |
dont show any directory or hidden file: |
842
a27a1c6ddde0
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
800
diff
changeset
|
180 |
(notice the basename extraction - we are not interested in the full pathName) |
593 | 181 |
[exBegin] |
351 | 182 |
|box| |
183 |
box := FileSelectionBox new. |
|
184 |
box title:'Which file ?'. |
|
185 |
box listView ignoreDirectories:true. |
|
186 |
box matchBlock:[:name | (name asFilename baseName startsWith:'.') not]. |
|
187 |
box open |
|
593 | 188 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
189 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
190 |
dont allow direct filename entry: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
191 |
(i.e. avoid the user choosing files from other directories) |
593 | 192 |
[exBegin] |
351 | 193 |
|box| |
194 |
box := FileSelectionBox new. |
|
195 |
box title:'Which one ?'. |
|
196 |
box enterField beInvisible. |
|
197 |
box open. |
|
198 |
box accepted ifTrue:[ |
|
655 | 199 |
Transcript showCR:'path is ' , box pathName |
351 | 200 |
]. |
593 | 201 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
202 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
203 |
combined with above directory ignoring, |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
204 |
this limits selection of files from a single directory: |
593 | 205 |
[exBegin] |
351 | 206 |
|box| |
207 |
box := FileSelectionBox new. |
|
208 |
box title:'Which file ?'. |
|
209 |
box enterField beInvisible. |
|
210 |
box listView ignoreDirectories:true. |
|
211 |
box open. |
|
212 |
box accepted ifTrue:[ |
|
655 | 213 |
Transcript showCR:'path is ' , box pathName |
351 | 214 |
]. |
593 | 215 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
216 |
|
238 | 217 |
finally, an action: |
593 | 218 |
[exBegin] |
351 | 219 |
|box| |
220 |
box := FileSelectionBox new. |
|
221 |
box title:'Which directory ?'. |
|
222 |
box pattern:'l*'. |
|
223 |
box matchBlock:[:name | OperatingSystem isDirectory:name]. |
|
655 | 224 |
box action:[:name | Transcript showCR:name]. |
351 | 225 |
box open |
593 | 226 |
[exEnd] |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
227 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
228 |
concrete examples: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
229 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
230 |
only show files beginning with lowercase characters |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
231 |
and ending in '.c': |
593 | 232 |
[exBegin] |
351 | 233 |
|box| |
234 |
box := FileSelectionBox new. |
|
235 |
box title:'Which directory ?'. |
|
236 |
box matchBlock:[:name | |
|
237 |
box pathName asFilename isDirectory |
|
238 |
or:[name first isLowercase |
|
239 |
and:[name endsWith:'.c']] |
|
240 |
]. |
|
241 |
box open. |
|
242 |
box accepted ifTrue:[ |
|
655 | 243 |
Transcript showCR:'full path: ' , box pathName. |
244 |
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
|
245 |
Transcript showCR:'directory : ' , box directory pathName. |
351 | 246 |
] |
593 | 247 |
[exEnd] |
7 | 248 |
" |
249 |
! ! |
|
0 | 250 |
|
1320 | 251 |
!FileSelectionBox class methodsFor:'accessing'! |
252 |
||
253 |
lastFileSelectionDirectory |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
254 |
"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
|
255 |
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
|
256 |
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
|
257 |
|
1574 | 258 |
|f| |
259 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
260 |
LastFileSelectionDirectory notNil ifTrue:[ |
1574 | 261 |
((f := LastFileSelectionDirectory asFilename) exists |
262 |
and:[f isDirectory]) ifFalse:[ |
|
263 |
LastFileSelectionDirectory := nil. |
|
264 |
] |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
265 |
]. |
1320 | 266 |
^ LastFileSelectionDirectory |
267 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
268 |
"Created: / 9.9.1997 / 10:03:17 / cg" |
1574 | 269 |
"Modified: / 16.6.1998 / 15:11:20 / cg" |
1320 | 270 |
! |
271 |
||
272 |
lastFileSelectionDirectory:aDirectoryString |
|
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
273 |
"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
|
274 |
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
|
275 |
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
|
276 |
|
1320 | 277 |
LastFileSelectionDirectory := aDirectoryString |
278 |
||
1571
fdaa3b9aa746
flush lastFileSelectionDirectory, if it does not exists
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
279 |
"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
|
280 |
"Modified: / 15.6.1998 / 14:05:21 / cg" |
1320 | 281 |
! ! |
282 |
||
849 | 283 |
!FileSelectionBox class methodsFor:'defaults'! |
12 | 284 |
|
285 |
listViewType |
|
286 |
"return the type of listView - using a FileSelectionList here" |
|
287 |
||
288 |
^ FileSelectionList |
|
289 |
! ! |
|
290 |
||
197 | 291 |
!FileSelectionBox methodsFor:'accessing'! |
3 | 292 |
|
197 | 293 |
contents |
294 |
"return the current entered value (i.e. the enterFields string). |
|
295 |
redefined to return the full pathname." |
|
296 |
||
297 |
|string sep| |
|
3 | 298 |
|
197 | 299 |
string := super contents. |
300 |
string isNil ifTrue:[ |
|
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
301 |
^ selectionList directory pathName |
121 | 302 |
]. |
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
303 |
(string asFilename isAbsolute) ifTrue:[ |
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
304 |
^ string |
77 | 305 |
]. |
197 | 306 |
^ (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
|
307 |
|
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
308 |
"Modified: / 9.9.1998 / 21:23:16 / cg" |
132 | 309 |
! |
310 |
||
1671 | 311 |
ied: / 9.9.1998 / 21:23:16 / cg" |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
312 |
! |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
313 |
|
1671 | 314 |
^ selectionList directory |
132 | 315 |
! |
316 |
||
1671 | 317 |
tionList directory:directoryName |
351 | 318 |
! |
319 |
||
1671 | 320 |
ed: / 12.8.1998 / 09:54:01 / cg" |
197 | 321 |
! |
0 | 322 |
|
1671 | 323 |
selectionList matchBlock:aBlock |
38 | 324 |
! |
325 |
||
351 | 326 |
pathName |
327 |
"same as contents - return the full pathname of the selected file, |
|
328 |
or the pathname of the directory if nothing has been entered" |
|
329 |
||
330 |
^ self contents |
|
331 |
! |
|
332 |
||
1671 | 333 |
entered" |
130 | 334 |
|
1671 | 335 |
^ self contents |
351 | 336 |
! |
337 |
||
338 |
selectingDirectory:aBoolean |
|
849 | 339 |
"setup the box for directory selection (hides regular files). |
340 |
Use this, to ask the user for a directories name" |
|
341 |
||
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
342 |
selectingDirectory := aBoolean. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
343 |
aBoolean ifTrue:[ |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
344 |
selectionList directoryChangeAction:[:entry | self directoryChanged]. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
345 |
selectionList directorySelectAction:[:entry | self directorySelected]. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
346 |
selectionList ignoreFiles:true. |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
347 |
] |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
348 |
|
849 | 349 |
"Modified: 22.10.1996 / 13:24:50 / cg" |
197 | 350 |
! ! |
351 |
||
352 |
!FileSelectionBox methodsFor:'change & update'! |
|
353 |
||
354 |
update:something with:argument from:changedObject |
|
355 |
|commonName index s| |
|
356 |
||
357 |
something == #directory ifTrue:[ |
|
358 |
" |
|
359 |
sent by fileNameEnterField, if a filename |
|
360 |
completion was not possible due to multiple |
|
361 |
matches. |
|
362 |
" |
|
363 |
selectionList directory:argument. |
|
364 |
s := enterField contents. |
|
365 |
s notNil ifTrue:[ |
|
366 |
commonName := s asFilename baseName. |
|
367 |
commonName size > 0 ifTrue:[ |
|
368 |
index := selectionList list findFirst:[:entry | entry startsWith:commonName]. |
|
369 |
index ~~ 0 ifTrue:[ |
|
370 |
selectionList makeLineVisible:index |
|
371 |
] |
|
372 |
] |
|
373 |
] |
|
374 |
] |
|
375 |
! ! |
|
376 |
||
377 |
!FileSelectionBox methodsFor:'initialization'! |
|
378 |
||
1671 | 379 |
ionBox methodsFor:'initialization'! |
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
380 |
|
1671 | 381 |
fied: 18.4.1996 / 20:02:24 / cg" |
38 | 382 |
! |
0 | 383 |
|
1671 | 384 |
ied: 18.10.1997 / 02:47:49 / cg" |
197 | 385 |
! ! |
386 |
||
387 |
!FileSelectionBox methodsFor:'private'! |
|
388 |
||
1671 | 389 |
eSelectionBox methodsFor:'private'! ! |
38 | 390 |
|
197 | 391 |
!FileSelectionBox methodsFor:'queries'! |
392 |
||
1671 | 393 |
eSelectionBox methodsFor:'queries'! ! |
197 | 394 |
|
395 |
!FileSelectionBox methodsFor:'user actions'! |
|
396 |
||
1671 | 397 |
ctionBox methodsFor:'user actions'! |
548
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
398 |
|
1671 | 399 |
fied: 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
|
400 |
! |
c418699a90c0
moved all request methods (class protocol) to DialogBox
Claus Gittinger <cg@exept.de>
parents:
438
diff
changeset
|
401 |
|
1671 | 402 |
ied: / 7.8.1998 / 17:19:26 / cg" |
197 | 403 |
! |
404 |
||
405 |
okPressed |
|
406 |
"called for both on ok-press and on return-key" |
|
407 |
||
408 |
|dir string fname| |
|
409 |
||
410 |
string := enterField contents. |
|
351 | 411 |
(string notNil and:[string notEmpty]) ifTrue:[ |
412 |
string := string withoutSeparators. |
|
1670
8d24855a9f0b
oops - handle absolute filenames correctly under vms and msdos
Claus Gittinger <cg@exept.de>
parents:
1643
diff
changeset
|
413 |
self halt. |
351 | 414 |
string asFilename isAbsolute ifTrue:[ |
415 |
fname := string asFilename |
|
416 |
] ifFalse:[ |
|
417 |
dir := selectionList directory pathName asFilename. |
|
418 |
fname := dir construct:string |
|
419 |
]. |
|
420 |
fname isDirectory ifTrue:[ |
|
421 |
selectingDirectory ifFalse:[ |
|
422 |
selectionList directory:fname asString. |
|
423 |
self updateList. |
|
424 |
^ self |
|
425 |
] |
|
426 |
] |
|
427 |
] ifFalse:[ |
|
428 |
selectingDirectory ifTrue:[ |
|
429 |
enterField contents:(selectionList directory pathName). |
|
430 |
]. |
|
38 | 431 |
]. |
351 | 432 |
|
197 | 433 |
super okPressed |
351 | 434 |
|
1671 | 435 |
<<<<<<< FSelBox.st |
436 |
"Modified: / 9.9.1998 / 21:42:33 / cg" |
|
197 | 437 |
! |
438 |
||
1671 | 439 |
]. |
440 |
]. |
|
441 |
||
442 |
super okPressed |
|
443 |
||
444 |
"Modified: / 9.9.1998 / 21:21:14 / cg" |
|
445 |
======= |
|
446 |
"Modified: / 9.9.1998 / 21:21:14 / cg" |
|
447 |
>>>>>>> 1.52 |
|
448 |
! |
|
449 |
||
450 |
:patternField contents. |
|
746
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
451 |
self updateList |
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
452 |
|
4442a4d4121f
dont want return in patternField to be accept of box
Claus Gittinger <cg@exept.de>
parents:
740
diff
changeset
|
453 |
"Created: 4.6.1996 / 20:30:23 / cg" |
0 | 454 |
! ! |
197 | 455 |
|
849 | 456 |
!FileSelectionBox class methodsFor:'documentation'! |
240 | 457 |
|
458 |
version |
|
1671 | 459 |
^ '$Header: /cvs/stx/stx/libwidg/FileSelectionBox.st,v 1.53 1998-09-09 20:27:16 cg Exp $' |
240 | 460 |
! ! |