FSelBox.st
changeset 59 450ce95a72a4
parent 44 f5e3a267fe4e
child 62 7cc1e330da47
--- a/FSelBox.st	Tue Aug 30 00:54:47 1994 +0200
+++ b/FSelBox.st	Mon Oct 10 04:03:47 1994 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1990 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
 
 FileSelectionBox comment:'
 COPYRIGHT (c) 1990 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.9 1994-08-11 23:47:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.10 1994-10-10 03:01:28 claus Exp $
 '!
 
 !FileSelectionBox class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
 copyright
 "
  COPYRIGHT (c) 1990 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.9 1994-08-11 23:47:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/FSelBox.st,v 1.10 1994-10-10 03:01:28 claus Exp $
 "
 !
 
@@ -63,44 +63,44 @@
 
     Example1:
 
-        FileSelectionBox open
+	FileSelectionBox open
 
     Example2:
 
-        FileSelectionBox new open
+	FileSelectionBox new open
 
     Example3:
 
-        |box|
-        box := FileSelectionBox new.
-        box title:'Which file ?'.
-        box open
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which file ?'.
+	box open
 
     Example4:
 
-        |box|
-        box := FileSelectionBox new.
-        box title:'Which file ?'.
-        box pattern:'*.doc'.
-        box open
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which file ?'.
+	box pattern:'*.doc'.
+	box open
 
     Example5:
 
-        |box|
-        box := FileSelectionBox new.
-        box title:'Which file ?'.
-        box pattern:'*'.
-        box matchBlock:[:name | name first isLowercase].
-        box open
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which file ?'.
+	box pattern:'*'.
+	box matchBlock:[:name | name first isLowercase].
+	box open
 
     Example5:
 
-        |box|
-        box := FileSelectionBox new.
-        box title:'Which directory ?'.
-        box pattern:'l*'.
-        box matchBlock:[:name | OperatingSystem isDirectory:name].
-        box open
+	|box|
+	box := FileSelectionBox new.
+	box title:'Which directory ?'.
+	box pattern:'l*'.
+	box matchBlock:[:name | OperatingSystem isDirectory:name].
+	box open
 "
 ! !
 
@@ -123,32 +123,33 @@
 
     patternField := EditField in:self.
     patternField 
-        origin:(0.7 @ labelField origin y)
-        corner:(1.0 @ (labelField origin y+patternField heightIncludingBorder)).
+	origin:(0.7 @ labelField origin y)
+	corner:(1.0 @ (labelField origin y+patternField heightIncludingBorder)).
+    patternField rightInset:(ViewSpacing // 2).
     patternField initialText:'*'.
     patternField leaveAction:[:reason | 
-        selectionList pattern:patternField contents. 
-        self updateList
+	selectionList pattern:patternField contents. 
+	self updateList
     ].
     patternField hidden:true. "delay showing, until a pattern is defined"
 
     selectionList action:[:line |
-        |entry|
+	|entry|
 
-        entry := selectionList selectionValue.
-        enterField contents:entry
+	entry := selectionList selectionValue.
+	enterField contents:entry
     ].
 
     selectionList doubleClickAction:[:line |
-        |entry|
+	|entry|
 
-        entry := selectionList selectionValue.
-        entry notNil ifTrue:[
-            ((selectionList directory typeOf:entry) == #directory) ifFalse:[
-                enterField contents:entry.
-                self okPressed
-            ]
-        ]
+	entry := selectionList selectionValue.
+	entry notNil ifTrue:[
+	    ((selectionList directory typeOf:entry) == #directory) ifFalse:[
+		enterField contents:entry.
+		self okPressed
+	    ]
+	]
     ].
     enterField addDependent:self.
 
@@ -162,9 +163,9 @@
      to live with the dump field ...
     "
     FilenameEditField notNil ifTrue:[
-        enterField := FilenameEditField in:self.
+	enterField := FilenameEditField in:self.
     ] ifFalse:[
-        super createEnterField
+	super createEnterField
     ]
 ! !
 
@@ -174,19 +175,19 @@
     |commonName index|
 
     something == #directory ifTrue:[
-        "
-         sent by fileNameEnterField, if a filename
-         completion was not possible due to multiple
-         matches.
-        "
-        selectionList directory:argument.
-        commonName := enterField contents asFilename baseName.
-        commonName size > 0 ifTrue:[
-            index := selectionList list findFirst:[:entry | entry startsWith:commonName].
-            index ~~ 0 ifTrue:[
-                selectionList makeLineVisible:index
-            ]
-        ]
+	"
+	 sent by fileNameEnterField, if a filename
+	 completion was not possible due to multiple
+	 matches.
+	"
+	selectionList directory:argument.
+	commonName := enterField contents asFilename baseName.
+	commonName size > 0 ifTrue:[
+	    index := selectionList list findFirst:[:entry | entry startsWith:commonName].
+	    index ~~ 0 ifTrue:[
+		selectionList makeLineVisible:index
+	    ]
+	]
     ]
 ! !
 
@@ -199,18 +200,18 @@
 
     string := enterField contents.
     string notNil ifTrue:[
-        string := string withoutSeparators.
-        string asFilename isAbsolute ifTrue:[
-            fname := string asFilename
-        ] ifFalse:[
-            dir := selectionList directory pathName asFilename.
-            fname := dir construct:string
-        ].
-        fname isDirectory ifTrue:[
-            selectionList directory:fname asString.
-            self updateList.
-            ^ self
-        ]
+	string := string withoutSeparators.
+	string asFilename isAbsolute ifTrue:[
+	    fname := string asFilename
+	] ifFalse:[
+	    dir := selectionList directory pathName asFilename.
+	    fname := dir construct:string
+	].
+	fname isDirectory ifTrue:[
+	    selectionList directory:fname asString.
+	    self updateList.
+	    ^ self
+	]
     ].
     super okPressed
 ! !
@@ -244,15 +245,15 @@
     patternField initialText:aPattern.
     selectionList pattern:aPattern.
     aPattern isNil ifTrue:[
-        patternField hidden:true.
-        realized ifTrue:[
-            patternField hide.
-        ]
+	patternField hidden:true.
+	realized ifTrue:[
+	    patternField hide.
+	]
     ] ifFalse:[
-        patternField hidden:false.
-        realized ifTrue:[
-            patternField realize.
-        ].
+	patternField hidden:false.
+	realized ifTrue:[
+	    patternField realize.
+	].
     ].
 !
 
@@ -264,11 +265,11 @@
      selection-name to the block."
 
     selectionList matchBlock:[:name | 
-        |dir fullPath|
+	|dir fullPath|
 
-        dir := selectionList directory pathName asFilename.
-        fullPath := dir construct:name. 
-        aBlock value:fullPath asString
+	dir := selectionList directory pathName asFilename.
+	fullPath := dir construct:name. 
+	aBlock value:fullPath asString
     ]
 !
 
@@ -280,11 +281,11 @@
 
     string := super contents.
     string isNil ifTrue:[
-        ^ selectionList directory pathName
+	^ selectionList directory pathName
     ].
     sep := Filename separator.
     (string startsWith:sep) ifTrue:[
-        ^ string
+	^ string
     ].
     ^ (selectionList directory pathName asFilename construct:string) asString
 ! !